Skip to content

Commit

Permalink
added count_ones
Browse files Browse the repository at this point in the history
  • Loading branch information
shiinamiyuki committed Mar 25, 2024
1 parent a8692f2 commit d90b260
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions luisa_compute/src/lang/ops/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ where
fn leading_zeros(&self) -> Expr<u32> {
Func::Clz.call(self.clone())
}
fn count_ones(&self) -> Expr<u32> {
Func::PopCount.call(self.clone())
}
}

macro_rules! impl_simple_fns {
Expand Down
1 change: 1 addition & 0 deletions luisa_compute/src/lang/ops/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ pub trait IntExpr {
fn rotate_left(&self, n: Expr<u32>) -> Self;
fn trailing_zeros(&self) -> Expr<u32>;
fn leading_zeros(&self) -> Expr<u32>;
fn count_ones(&self) -> Expr<u32>;
}

pub trait FloatExpr: Sized {
Expand Down

0 comments on commit d90b260

Please sign in to comment.