Skip to content

Commit 62ff887

Browse files
committed
stage2+stage1: remove type parameter from bit builtins
Closes #12529 Closes #12511 Closes #6835
1 parent 6c020cd commit 62ff887

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+264
-268
lines changed

doc/langref.html.in

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8031,8 +8031,8 @@ fn func(y: *i32) void {
80318031
{#header_close#}
80328032

80338033
{#header_open|@byteSwap#}
8034-
<pre>{#syntax#}@byteSwap(comptime T: type, operand: T) T{#endsyntax#}</pre>
8035-
<p>{#syntax#}T{#endsyntax#} must be an integer type with bit count evenly divisible by 8.</p>
8034+
<pre>{#syntax#}@byteSwap(operand: anytype) T{#endsyntax#}</pre>
8035+
<p>{#syntax#}@TypeOf(operand){#endsyntax#} must be an integer type or an integer vector type with bit count evenly divisible by 8.</p>
80368036
<p>{#syntax#}operand{#endsyntax#} may be an {#link|integer|Integers#} or {#link|vector|Vectors#}.</p>
80378037
<p>
80388038
Swaps the byte order of the integer. This converts a big endian integer to a little endian integer,
@@ -8049,8 +8049,8 @@ fn func(y: *i32) void {
80498049
{#header_close#}
80508050

80518051
{#header_open|@bitReverse#}
8052-
<pre>{#syntax#}@bitReverse(comptime T: type, integer: T) T{#endsyntax#}</pre>
8053-
<p>{#syntax#}T{#endsyntax#} accepts any integer type.</p>
8052+
<pre>{#syntax#}@bitReverse(integer: anytype) T{#endsyntax#}</pre>
8053+
<p>{#syntax#}@TypeOf(anytype){#endsyntax#} accepts any integer type or integer vector type.</p>
80548054
<p>
80558055
Reverses the bitpattern of an integer value, including the sign bit if applicable.
80568056
</p>
@@ -8189,8 +8189,8 @@ pub const CallOptions = struct {
81898189
{#header_close#}
81908190

81918191
{#header_open|@clz#}
8192-
<pre>{#syntax#}@clz(comptime T: type, operand: T){#endsyntax#}</pre>
8193-
<p>{#syntax#}T{#endsyntax#} must be an integer type.</p>
8192+
<pre>{#syntax#}@clz(operand: anytype){#endsyntax#}</pre>
8193+
<p>{#syntax#}@TypeOf(operand){#endsyntax#} must be an integer type or an integer vector type.</p>
81948194
<p>{#syntax#}operand{#endsyntax#} may be an {#link|integer|Integers#} or {#link|vector|Vectors#}.</p>
81958195
<p>
81968196
This function counts the number of most-significant (leading in a big-Endian sense) zeroes in an integer.
@@ -8335,8 +8335,8 @@ test "main" {
83358335
{#header_close#}
83368336

83378337
{#header_open|@ctz#}
8338-
<pre>{#syntax#}@ctz(comptime T: type, operand: T){#endsyntax#}</pre>
8339-
<p>{#syntax#}T{#endsyntax#} must be an integer type.</p>
8338+
<pre>{#syntax#}@ctz(operand: anytype){#endsyntax#}</pre>
8339+
<p>{#syntax#}@TypeOf(operand){#endsyntax#} must be an integer type or an integer vector type.</p>
83408340
<p>{#syntax#}operand{#endsyntax#} may be an {#link|integer|Integers#} or {#link|vector|Vectors#}.</p>
83418341
<p>
83428342
This function counts the number of least-significant (trailing in a big-Endian sense) zeroes in an integer.
@@ -8972,8 +8972,8 @@ test "@wasmMemoryGrow" {
89728972
{#header_close#}
89738973

89748974
{#header_open|@popCount#}
8975-
<pre>{#syntax#}@popCount(comptime T: type, operand: T){#endsyntax#}</pre>
8976-
<p>{#syntax#}T{#endsyntax#} must be an integer type.</p>
8975+
<pre>{#syntax#}@popCount(operand: anytype){#endsyntax#}</pre>
8976+
<p>{#syntax#}@TypeOf(operand){#endsyntax#} must be an integer type.</p>
89778977
<p>{#syntax#}operand{#endsyntax#} may be an {#link|integer|Integers#} or {#link|vector|Vectors#}.</p>
89788978
<p>Counts the number of bits set in an integer.</p>
89798979
<p>

lib/compiler_rt/addf3.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const normalize = common.normalize;
99
pub inline fn addf3(comptime T: type, a: T, b: T) T {
1010
const bits = @typeInfo(T).Float.bits;
1111
const Z = std.meta.Int(.unsigned, bits);
12-
const S = std.meta.Int(.unsigned, bits - @clz(Z, @as(Z, bits) - 1));
12+
const S = std.meta.Int(.unsigned, bits - @clz(@as(Z, bits) - 1));
1313

1414
const typeWidth = bits;
1515
const significandBits = math.floatMantissaBits(T);
@@ -118,7 +118,7 @@ pub inline fn addf3(comptime T: type, a: T, b: T) T {
118118
// If partial cancellation occured, we need to left-shift the result
119119
// and adjust the exponent:
120120
if (aSignificand < integerBit << 3) {
121-
const shift = @intCast(i32, @clz(Z, aSignificand)) - @intCast(i32, @clz(std.meta.Int(.unsigned, bits), integerBit << 3));
121+
const shift = @intCast(i32, @clz(aSignificand)) - @intCast(i32, @clz(integerBit << 3));
122122
aSignificand <<= @intCast(S, shift);
123123
aExponent -= shift;
124124
}

lib/compiler_rt/common.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ pub fn normalize(comptime T: type, significand: *std.meta.Int(.unsigned, @typeIn
192192
const Z = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
193193
const integerBit = @as(Z, 1) << std.math.floatFractionalBits(T);
194194

195-
const shift = @clz(Z, significand.*) - @clz(Z, integerBit);
195+
const shift = @clz(significand.*) - @clz(integerBit);
196196
significand.* <<= @intCast(std.math.Log2Int(Z), shift);
197197
return @as(i32, 1) - shift;
198198
}

lib/compiler_rt/extendf.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ pub inline fn extendf(
5656
// a is denormal.
5757
// renormalize the significand and clear the leading bit, then insert
5858
// the correct adjusted exponent in the destination type.
59-
const scale: u32 = @clz(src_rep_t, aAbs) -
60-
@clz(src_rep_t, @as(src_rep_t, srcMinNormal));
59+
const scale: u32 = @clz(aAbs) -
60+
@clz(@as(src_rep_t, srcMinNormal));
6161
absResult = @as(dst_rep_t, aAbs) << @intCast(DstShift, dstSigBits - srcSigBits + scale);
6262
absResult ^= dstMinNormal;
6363
const resultExponent: u32 = dstExpBias - srcExpBias - scale + 1;
@@ -119,8 +119,8 @@ pub inline fn extend_f80(comptime src_t: type, a: std.meta.Int(.unsigned, @typeI
119119
// a is denormal.
120120
// renormalize the significand and clear the leading bit, then insert
121121
// the correct adjusted exponent in the destination type.
122-
const scale: u16 = @clz(src_rep_t, a_abs) -
123-
@clz(src_rep_t, @as(src_rep_t, src_min_normal));
122+
const scale: u16 = @clz(a_abs) -
123+
@clz(@as(src_rep_t, src_min_normal));
124124

125125
dst.fraction = @as(u64, a_abs) << @intCast(u6, dst_sig_bits - src_sig_bits + scale);
126126
dst.fraction |= dst_int_bit; // bit 64 is always set for normal numbers

lib/compiler_rt/extendxftf2.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn __extendxftf2(a: f80) callconv(.C) f128 {
3838
// a is denormal
3939
// renormalize the significand and clear the leading bit and integer part,
4040
// then insert the correct adjusted exponent in the destination type.
41-
const scale: u32 = @clz(u64, a_rep.fraction);
41+
const scale: u32 = @clz(a_rep.fraction);
4242
abs_result = @as(u128, a_rep.fraction) << @intCast(u7, dst_sig_bits - src_sig_bits + scale + 1);
4343
abs_result ^= dst_min_normal;
4444
abs_result |= @as(u128, scale + 1) << dst_sig_bits;

lib/compiler_rt/int.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ inline fn div_u32(n: u32, d: u32) u32 {
243243
// special cases
244244
if (d == 0) return 0; // ?!
245245
if (n == 0) return 0;
246-
var sr = @bitCast(c_uint, @as(c_int, @clz(u32, d)) - @as(c_int, @clz(u32, n)));
246+
var sr = @bitCast(c_uint, @as(c_int, @clz(d)) - @as(c_int, @clz(n)));
247247
// 0 <= sr <= n_uword_bits - 1 or sr large
248248
if (sr > n_uword_bits - 1) {
249249
// d > r

lib/compiler_rt/int_to_float.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn intToFloat(comptime T: type, x: anytype) T {
2323
var result: uT = sign_bit;
2424

2525
// Compute significand
26-
var exp = int_bits - @clz(Z, abs_val) - 1;
26+
var exp = int_bits - @clz(abs_val) - 1;
2727
if (int_bits <= fractional_bits or exp <= fractional_bits) {
2828
const shift_amt = fractional_bits - @intCast(math.Log2Int(uT), exp);
2929

@@ -32,7 +32,7 @@ pub fn intToFloat(comptime T: type, x: anytype) T {
3232
result ^= implicit_bit; // Remove implicit integer bit
3333
} else {
3434
var shift_amt = @intCast(math.Log2Int(Z), exp - fractional_bits);
35-
const exact_tie: bool = @ctz(Z, abs_val) == shift_amt - 1;
35+
const exact_tie: bool = @ctz(abs_val) == shift_amt - 1;
3636

3737
// Shift down result and remove implicit integer bit
3838
result = @intCast(uT, (abs_val >> (shift_amt - 1))) ^ (implicit_bit << 1);

lib/compiler_rt/mulf3.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ fn normalize(comptime T: type, significand: *PowerOfTwoSignificandZ(T)) i32 {
186186
const Z = PowerOfTwoSignificandZ(T);
187187
const integerBit = @as(Z, 1) << math.floatFractionalBits(T);
188188

189-
const shift = @clz(Z, significand.*) - @clz(Z, integerBit);
189+
const shift = @clz(significand.*) - @clz(integerBit);
190190
significand.* <<= @intCast(math.Log2Int(Z), shift);
191191
return @as(i32, 1) - shift;
192192
}

lib/compiler_rt/udivmod.zig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ pub fn udivmod(comptime DoubleInt: type, a: DoubleInt, b: DoubleInt, maybe_rem:
7575
r[high] = n[high] & (d[high] - 1);
7676
rem.* = @ptrCast(*align(@alignOf(SingleInt)) DoubleInt, &r[0]).*; // TODO issue #421
7777
}
78-
return n[high] >> @intCast(Log2SingleInt, @ctz(SingleInt, d[high]));
78+
return n[high] >> @intCast(Log2SingleInt, @ctz(d[high]));
7979
}
8080
// K K
8181
// ---
8282
// K 0
83-
sr = @bitCast(c_uint, @as(c_int, @clz(SingleInt, d[high])) - @as(c_int, @clz(SingleInt, n[high])));
83+
sr = @bitCast(c_uint, @as(c_int, @clz(d[high])) - @as(c_int, @clz(n[high])));
8484
// 0 <= sr <= single_int_bits - 2 or sr large
8585
if (sr > single_int_bits - 2) {
8686
if (maybe_rem) |rem| {
@@ -110,15 +110,15 @@ pub fn udivmod(comptime DoubleInt: type, a: DoubleInt, b: DoubleInt, maybe_rem:
110110
if (d[low] == 1) {
111111
return a;
112112
}
113-
sr = @ctz(SingleInt, d[low]);
113+
sr = @ctz(d[low]);
114114
q[high] = n[high] >> @intCast(Log2SingleInt, sr);
115115
q[low] = (n[high] << @intCast(Log2SingleInt, single_int_bits - sr)) | (n[low] >> @intCast(Log2SingleInt, sr));
116116
return @ptrCast(*align(@alignOf(SingleInt)) DoubleInt, &q[0]).*; // TODO issue #421
117117
}
118118
// K X
119119
// ---
120120
// 0 K
121-
sr = 1 + single_int_bits + @as(c_uint, @clz(SingleInt, d[low])) - @as(c_uint, @clz(SingleInt, n[high]));
121+
sr = 1 + single_int_bits + @as(c_uint, @clz(d[low])) - @as(c_uint, @clz(n[high]));
122122
// 2 <= sr <= double_int_bits - 1
123123
// q.all = a << (double_int_bits - sr);
124124
// r.all = a >> sr;
@@ -144,7 +144,7 @@ pub fn udivmod(comptime DoubleInt: type, a: DoubleInt, b: DoubleInt, maybe_rem:
144144
// K X
145145
// ---
146146
// K K
147-
sr = @bitCast(c_uint, @as(c_int, @clz(SingleInt, d[high])) - @as(c_int, @clz(SingleInt, n[high])));
147+
sr = @bitCast(c_uint, @as(c_int, @clz(d[high])) - @as(c_int, @clz(n[high])));
148148
// 0 <= sr <= single_int_bits - 1 or sr large
149149
if (sr > single_int_bits - 1) {
150150
if (maybe_rem) |rem| {

lib/std/Thread/Futex.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ const PosixImpl = struct {
703703
const max_multiplier_bits = @bitSizeOf(usize);
704704
const fibonacci_multiplier = 0x9E3779B97F4A7C15 >> (64 - max_multiplier_bits);
705705

706-
const max_bucket_bits = @ctz(usize, buckets.len);
706+
const max_bucket_bits = @ctz(buckets.len);
707707
comptime assert(std.math.isPowerOfTwo(buckets.len));
708708

709709
const index = (address *% fibonacci_multiplier) >> (max_multiplier_bits - max_bucket_bits);
@@ -721,7 +721,7 @@ const PosixImpl = struct {
721721
// then cut off the zero bits from the alignment to get the unique address.
722722
const addr = @ptrToInt(ptr);
723723
assert(addr & (alignment - 1) == 0);
724-
return addr >> @ctz(usize, alignment);
724+
return addr >> @ctz(alignment);
725725
}
726726
};
727727

lib/std/Thread/Mutex.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ const FutexImpl = struct {
140140
// - they both seem to mark the cache-line as modified regardless: https://stackoverflow.com/a/63350048
141141
// - `lock bts` is smaller instruction-wise which makes it better for inlining
142142
if (comptime builtin.target.cpu.arch.isX86()) {
143-
const locked_bit = @ctz(u32, @as(u32, locked));
143+
const locked_bit = @ctz(@as(u32, locked));
144144
return self.state.bitSet(locked_bit, .Acquire) == 0;
145145
}
146146

lib/std/Thread/RwLock.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ pub const DefaultRwLock = struct {
168168
const IS_WRITING: usize = 1;
169169
const WRITER: usize = 1 << 1;
170170
const READER: usize = 1 << (1 + @bitSizeOf(Count));
171-
const WRITER_MASK: usize = std.math.maxInt(Count) << @ctz(usize, WRITER);
172-
const READER_MASK: usize = std.math.maxInt(Count) << @ctz(usize, READER);
171+
const WRITER_MASK: usize = std.math.maxInt(Count) << @ctz(WRITER);
172+
const READER_MASK: usize = std.math.maxInt(Count) << @ctz(READER);
173173
const Count = std.meta.Int(.unsigned, @divFloor(@bitSizeOf(usize) - 1, 2));
174174

175175
pub fn tryLock(rwl: *DefaultRwLock) bool {

lib/std/bit_set.zig

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub fn IntegerBitSet(comptime size: u16) type {
9191

9292
/// Returns the total number of set bits in this bit set.
9393
pub fn count(self: Self) usize {
94-
return @popCount(MaskInt, self.mask);
94+
return @popCount(self.mask);
9595
}
9696

9797
/// Changes the value of the specified bit of the bit
@@ -179,15 +179,15 @@ pub fn IntegerBitSet(comptime size: u16) type {
179179
pub fn findFirstSet(self: Self) ?usize {
180180
const mask = self.mask;
181181
if (mask == 0) return null;
182-
return @ctz(MaskInt, mask);
182+
return @ctz(mask);
183183
}
184184

185185
/// Finds the index of the first set bit, and unsets it.
186186
/// If no bits are set, returns null.
187187
pub fn toggleFirstSet(self: *Self) ?usize {
188188
const mask = self.mask;
189189
if (mask == 0) return null;
190-
const index = @ctz(MaskInt, mask);
190+
const index = @ctz(mask);
191191
self.mask = mask & (mask - 1);
192192
return index;
193193
}
@@ -222,12 +222,12 @@ pub fn IntegerBitSet(comptime size: u16) type {
222222

223223
switch (direction) {
224224
.forward => {
225-
const next_index = @ctz(MaskInt, self.bits_remain);
225+
const next_index = @ctz(self.bits_remain);
226226
self.bits_remain &= self.bits_remain - 1;
227227
return next_index;
228228
},
229229
.reverse => {
230-
const leading_zeroes = @clz(MaskInt, self.bits_remain);
230+
const leading_zeroes = @clz(self.bits_remain);
231231
const top_bit = (@bitSizeOf(MaskInt) - 1) - leading_zeroes;
232232
self.bits_remain &= (@as(MaskInt, 1) << @intCast(ShiftInt, top_bit)) - 1;
233233
return top_bit;
@@ -347,7 +347,7 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type {
347347
pub fn count(self: Self) usize {
348348
var total: usize = 0;
349349
for (self.masks) |mask| {
350-
total += @popCount(MaskInt, mask);
350+
total += @popCount(mask);
351351
}
352352
return total;
353353
}
@@ -475,7 +475,7 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type {
475475
if (mask != 0) break mask;
476476
offset += @bitSizeOf(MaskInt);
477477
} else return null;
478-
return offset + @ctz(MaskInt, mask);
478+
return offset + @ctz(mask);
479479
}
480480

481481
/// Finds the index of the first set bit, and unsets it.
@@ -486,7 +486,7 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type {
486486
if (mask.* != 0) break mask;
487487
offset += @bitSizeOf(MaskInt);
488488
} else return null;
489-
const index = @ctz(MaskInt, mask.*);
489+
const index = @ctz(mask.*);
490490
mask.* &= (mask.* - 1);
491491
return offset + index;
492492
}
@@ -657,7 +657,7 @@ pub const DynamicBitSetUnmanaged = struct {
657657
var total: usize = 0;
658658
for (self.masks[0..num_masks]) |mask| {
659659
// Note: This is where we depend on padding bits being zero
660-
total += @popCount(MaskInt, mask);
660+
total += @popCount(mask);
661661
}
662662
return total;
663663
}
@@ -795,7 +795,7 @@ pub const DynamicBitSetUnmanaged = struct {
795795
mask += 1;
796796
offset += @bitSizeOf(MaskInt);
797797
} else return null;
798-
return offset + @ctz(MaskInt, mask[0]);
798+
return offset + @ctz(mask[0]);
799799
}
800800

801801
/// Finds the index of the first set bit, and unsets it.
@@ -808,7 +808,7 @@ pub const DynamicBitSetUnmanaged = struct {
808808
mask += 1;
809809
offset += @bitSizeOf(MaskInt);
810810
} else return null;
811-
const index = @ctz(MaskInt, mask[0]);
811+
const index = @ctz(mask[0]);
812812
mask[0] &= (mask[0] - 1);
813813
return offset + index;
814814
}
@@ -1067,12 +1067,12 @@ fn BitSetIterator(comptime MaskInt: type, comptime options: IteratorOptions) typ
10671067

10681068
switch (direction) {
10691069
.forward => {
1070-
const next_index = @ctz(MaskInt, self.bits_remain) + self.bit_offset;
1070+
const next_index = @ctz(self.bits_remain) + self.bit_offset;
10711071
self.bits_remain &= self.bits_remain - 1;
10721072
return next_index;
10731073
},
10741074
.reverse => {
1075-
const leading_zeroes = @clz(MaskInt, self.bits_remain);
1075+
const leading_zeroes = @clz(self.bits_remain);
10761076
const top_bit = (@bitSizeOf(MaskInt) - 1) - leading_zeroes;
10771077
const no_top_bit_mask = (@as(MaskInt, 1) << @intCast(ShiftInt, top_bit)) - 1;
10781078
self.bits_remain &= no_top_bit_mask;

lib/std/compress/deflate/bits_utils.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const math = @import("std").math;
22

33
// Reverse bit-by-bit a N-bit code.
44
pub fn bitReverse(comptime T: type, value: T, N: usize) T {
5-
const r = @bitReverse(T, value);
5+
const r = @bitReverse(value);
66
return r >> @intCast(math.Log2Int(T), @typeInfo(T).Int.bits - N);
77
}
88

lib/std/crypto/aes_ocb.zig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fn AesOcb(comptime Aes: anytype) type {
6666
var offset = [_]u8{0} ** 16;
6767
var i: usize = 0;
6868
while (i < full_blocks) : (i += 1) {
69-
xorWith(&offset, lt[@ctz(usize, i + 1)]);
69+
xorWith(&offset, lt[@ctz(i + 1)]);
7070
var e = xorBlocks(offset, a[i * 16 ..][0..16].*);
7171
aes_enc_ctx.encrypt(&e, &e);
7272
xorWith(&sum, e);
@@ -129,7 +129,7 @@ fn AesOcb(comptime Aes: anytype) type {
129129
var es: [16 * wb]u8 align(16) = undefined;
130130
var j: usize = 0;
131131
while (j < wb) : (j += 1) {
132-
xorWith(&offset, lt[@ctz(usize, i + 1 + j)]);
132+
xorWith(&offset, lt[@ctz(i + 1 + j)]);
133133
offsets[j] = offset;
134134
const p = m[(i + j) * 16 ..][0..16].*;
135135
mem.copy(u8, es[j * 16 ..][0..16], &xorBlocks(p, offsets[j]));
@@ -143,7 +143,7 @@ fn AesOcb(comptime Aes: anytype) type {
143143
}
144144
}
145145
while (i < full_blocks) : (i += 1) {
146-
xorWith(&offset, lt[@ctz(usize, i + 1)]);
146+
xorWith(&offset, lt[@ctz(i + 1)]);
147147
const p = m[i * 16 ..][0..16].*;
148148
var e = xorBlocks(p, offset);
149149
aes_enc_ctx.encrypt(&e, &e);
@@ -193,7 +193,7 @@ fn AesOcb(comptime Aes: anytype) type {
193193
var es: [16 * wb]u8 align(16) = undefined;
194194
var j: usize = 0;
195195
while (j < wb) : (j += 1) {
196-
xorWith(&offset, lt[@ctz(usize, i + 1 + j)]);
196+
xorWith(&offset, lt[@ctz(i + 1 + j)]);
197197
offsets[j] = offset;
198198
const q = c[(i + j) * 16 ..][0..16].*;
199199
mem.copy(u8, es[j * 16 ..][0..16], &xorBlocks(q, offsets[j]));
@@ -207,7 +207,7 @@ fn AesOcb(comptime Aes: anytype) type {
207207
}
208208
}
209209
while (i < full_blocks) : (i += 1) {
210-
xorWith(&offset, lt[@ctz(usize, i + 1)]);
210+
xorWith(&offset, lt[@ctz(i + 1)]);
211211
const q = c[i * 16 ..][0..16].*;
212212
var e = xorBlocks(q, offset);
213213
aes_dec_ctx.decrypt(&e, &e);

0 commit comments

Comments
 (0)