Skip to content

Add to_mask function for Simd #479

@okaneco

Description

@okaneco

Open to suggestions on the naming and design, this is more of a convenience function but I think it's still generally useful.

fn to_mask(&self) -> Self::Mask {
    self.simd_ne(Simd::splat(0))
}

I'm not sure where these should live, I was thinking maybe SimdInt and SimdUint?
I'm also not sure if it should be included on SimdFloat.

Some Github usages, there may be more but these were the more obvious ones to query
https://github.com/search?q=language%3ARust+%22simd_ne%28zero%22+NOT+is%3Afork&type=code
https://github.com/search?q=language%3ARust+%22simd_ne%28Simd%3A%3Asplat%280%22+NOT+is%3Afork&type=code
Another pattern is for unsigned types checking simd_gt(zeros) but that's harder to separate as its own search.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions