| ... | ... | @@ -548,8 +548,8 @@ pub fn rotr(comptime T: type, x: T, r: anytype) T { |
| 548 | 548 | } else if (@typeInfo(T).Int.signedness == .signed) { |
| 549 | 549 | @compileError("cannot rotate signed integer"); |
| 550 | 550 | } else { |
| 551 | | const ar = @mod(r, @typeInfo(T).Int.bits); |
| 552 | | return shr(T, x, ar) | shl(T, x, @typeInfo(T).Int.bits - ar); |
| 551 | const ar = @intCast(Log2Int(T), @mod(r, @typeInfo(T).Int.bits)); |
| 552 | return x >> ar | x << (1 +% ~ar); |
| 553 | 553 | } |
| 554 | 554 | } |
| 555 | 555 | |
| ... | ... | @@ -576,8 +576,8 @@ pub fn rotl(comptime T: type, x: T, r: anytype) T { |
| 576 | 576 | } else if (@typeInfo(T).Int.signedness == .signed) { |
| 577 | 577 | @compileError("cannot rotate signed integer"); |
| 578 | 578 | } else { |
| 579 | | const ar = @mod(r, @typeInfo(T).Int.bits); |
| 580 | | return shl(T, x, ar) | shr(T, x, @typeInfo(T).Int.bits - ar); |
| 579 | const ar = @intCast(Log2Int(T), @mod(r, @typeInfo(T).Int.bits)); |
| 580 | return x << ar | x >> 1 +% ~ar; |
| 581 | 581 | } |
| 582 | 582 | } |
| 583 | 583 | |