mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-11 14:26:21 +00:00
correct counting bits to return a u8
Also add an impl to the dev backend
This commit is contained in:
parent
e336aa525c
commit
6692f5b15d
4 changed files with 36 additions and 21 deletions
|
@ -1765,6 +1765,21 @@ trait Backend<'a> {
|
|||
let intrinsic = bitcode::NUM_IS_MULTIPLE_OF[int_width].to_string();
|
||||
self.build_fn_call(sym, intrinsic, args, arg_layouts, ret_layout);
|
||||
}
|
||||
LowLevel::NumCountLeadingZeroBits => {
|
||||
let int_width = arg_layouts[0].try_int_width().unwrap();
|
||||
let intrinsic = bitcode::NUM_COUNT_LEADING_ZERO_BITS[int_width].to_string();
|
||||
self.build_fn_call(sym, intrinsic, args, arg_layouts, ret_layout);
|
||||
}
|
||||
LowLevel::NumCountTrailingZeroBits => {
|
||||
let int_width = arg_layouts[0].try_int_width().unwrap();
|
||||
let intrinsic = bitcode::NUM_COUNT_TRAILING_ZERO_BITS[int_width].to_string();
|
||||
self.build_fn_call(sym, intrinsic, args, arg_layouts, ret_layout);
|
||||
}
|
||||
LowLevel::NumCountOneBits => {
|
||||
let int_width = arg_layouts[0].try_int_width().unwrap();
|
||||
let intrinsic = bitcode::NUM_COUNT_ONE_BITS[int_width].to_string();
|
||||
self.build_fn_call(sym, intrinsic, args, arg_layouts, ret_layout);
|
||||
}
|
||||
LowLevel::ListSublist => {
|
||||
// list: RocList,
|
||||
// alignment: u32,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue