mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
all: ~500 more byte=>u8
This commit is contained in:
@ -9,10 +9,9 @@ const (
|
||||
de_bruijn32tab = [u8(0), 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13,
|
||||
23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9]
|
||||
de_bruijn64 = u64(0x03f79d71b4ca8b09)
|
||||
de_bruijn64tab = [u8(0), 1, 56, 2, 57, 49, 28, 3, 61, 58, 42, 50, 38, 29, 17, 4, 62, 47,
|
||||
59, 36, 45, 43, 51, 22, 53, 39, 33, 30, 24, 18, 12, 5, 63, 55, 48, 27, 60, 41, 37, 16,
|
||||
46, 35, 44, 21, 52, 32, 23, 11, 54, 26, 40, 15, 34, 20, 31, 10, 25, 14, 19, 9, 13, 8, 7,
|
||||
6]
|
||||
de_bruijn64tab = [u8(0), 1, 56, 2, 57, 49, 28, 3, 61, 58, 42, 50, 38, 29, 17, 4, 62, 47, 59,
|
||||
36, 45, 43, 51, 22, 53, 39, 33, 30, 24, 18, 12, 5, 63, 55, 48, 27, 60, 41, 37, 16, 46,
|
||||
35, 44, 21, 52, 32, 23, 11, 54, 26, 40, 15, 34, 20, 31, 10, 25, 14, 19, 9, 13, 8, 7, 6]
|
||||
)
|
||||
|
||||
const (
|
||||
@ -31,7 +30,7 @@ const (
|
||||
|
||||
// --- LeadingZeros ---
|
||||
// leading_zeros_8 returns the number of leading zero bits in x; the result is 8 for x == 0.
|
||||
pub fn leading_zeros_8(x byte) int {
|
||||
pub fn leading_zeros_8(x u8) int {
|
||||
return 8 - len_8(x)
|
||||
}
|
||||
|
||||
@ -146,7 +145,7 @@ pub fn ones_count_64(x u64) int {
|
||||
//
|
||||
// This function's execution time does not depend on the inputs.
|
||||
[inline]
|
||||
pub fn rotate_left_8(x byte, k int) byte {
|
||||
pub fn rotate_left_8(x u8, k int) u8 {
|
||||
n := u8(8)
|
||||
s := u8(k) & (n - u8(1))
|
||||
return (x << s) | (x >> (n - s))
|
||||
|
Reference in New Issue
Block a user