x86_64: implement switch jump tables

This commit is contained in:
Jacob Young
2025-01-02 03:10:19 -05:00
parent ac1a975f9b
commit e5d5a8bc4e
33 changed files with 476 additions and 199 deletions

View File

@@ -2523,7 +2523,7 @@ pub const Const = struct {
/// Returns the number of leading zeros in twos-complement form.
pub fn clz(a: Const, bits: Limb) Limb {
// Limbs are stored in little-endian order but we need to iterate big-endian.
if (!a.positive) return 0;
if (!a.positive and !a.eqlZero()) return 0;
var total_limb_lz: Limb = 0;
var i: usize = a.limbs.len;
const bits_per_limb = @bitSizeOf(Limb);