| 21 | |
| 22 | #[expect(non_snake_case)] |
| 23 | fn define(lib: &mut StandardLibrary<'_, 'heap>) -> ModuleDef<'heap> { |
| 24 | let mut def = ModuleDef::new(); |
| 25 | |
| 26 | let Integer = lib.ty.integer(); |
| 27 | |
| 28 | let items = [ |
| 29 | ( |
| 30 | "::core::bits::and", |
| 31 | &["&"], |
| 32 | decl!(lib; <>(lhs: Integer, rhs: Integer) -> Integer), |
| 33 | ), |
| 34 | ( |
| 35 | "::core::bits::or", |
| 36 | &["|"], |
| 37 | decl!(lib; <>(lhs: Integer, rhs: Integer) -> Integer), |
| 38 | ), |
| 39 | ( |
| 40 | "::core::bits::xor", |
| 41 | &["^"], |
| 42 | decl!(lib; <>(lhs: Integer, rhs: Integer) -> Integer), |
| 43 | ), |
| 44 | ( |
| 45 | "::core::bits::not", |
| 46 | &["~"], |
| 47 | decl!(lib; <>(value: Integer) -> Integer), |
| 48 | ), |
| 49 | ( |
| 50 | "::core::bits::shl", |
| 51 | &["<<"], |
| 52 | // In the future we might want to specialize the `shift` to `Natural` |
| 53 | decl!(lib; <>(value: Integer, shift: Integer) -> Integer), |
| 54 | ), |
| 55 | ( |
| 56 | "::core::bits::shr", |
| 57 | &[">>"], |
| 58 | // In the future we might want to specialize the `shift` to `Natural` |
| 59 | decl!(lib; <>(value: Integer, shift: Integer) -> Integer), |
| 60 | ), |
| 61 | ]; |
| 62 | |
| 63 | for (name, alias, r#type) in items { |
| 64 | func(lib, &mut def, name, alias, r#type); |
| 65 | } |
| 66 | |
| 67 | def |
| 68 | } |
| 69 | } |