| 1 | const std = @import("../std.zig"); |
| 2 | const assert = std.debug.assert; |
| 3 | |
| 4 | pub const int = @import("big/int.zig"); |
| 5 | pub const Limb = usize; |
| 6 | const limb_info = @typeInfo(Limb).int; |
| 7 | pub const SignedLimb = @Int(.signed, limb_info.bits); |
| 8 | pub const DoubleLimb = @Int(.unsigned, 2 * limb_info.bits); |
| 9 | pub const HalfLimb = @Int(.unsigned, limb_info.bits / 2); |
| 10 | pub const SignedDoubleLimb = @Int(.signed, 2 * limb_info.bits); |
| 11 | pub const Log2Limb = std.math.Log2Int(Limb); |
| 12 | |
| 13 | comptime { |
| 14 | assert(std.math.floorPowerOfTwo(usize, limb_info.bits) == limb_info.bits); |
| 15 | assert(limb_info.signedness == .unsigned); |
| 16 | } |
| 17 | |
| 18 | test { |
| 19 | _ = int; |
| 20 | _ = Limb; |
| 21 | _ = SignedLimb; |
| 22 | _ = DoubleLimb; |
| 23 | _ = SignedDoubleLimb; |
| 24 | _ = Log2Limb; |
| 25 | } |