@@ -1283,8 +1283,8 @@ static void dequantize_row_q4_0(const block_q4_0 * restrict x, float * restrict
12831283 const float d = x [i ].d ;
12841284
12851285 for (int j = 0 ; j < qk /2 ; ++ j ) {
1286- const int x0 = (x [i ].qs [j ] & 0xf ) - 8 ;
1287- const int x1 = (x [i ].qs [j ] >> 4 ) - 8 ;
1286+ const int x0 = (x [i ].qs [j ] & 0x0F ) - 8 ;
1287+ const int x1 = (x [i ].qs [j ] >> 4 ) - 8 ;
12881288
12891289 y [i * qk + j + 0 ] = x0 * d ;
12901290 y [i * qk + j + qk /2 ] = x1 * d ;
@@ -1304,8 +1304,8 @@ static void dequantize_row_q4_1(const block_q4_1 * restrict x, float * restrict
13041304 const float m = x [i ].m ;
13051305
13061306 for (int j = 0 ; j < qk /2 ; ++ j ) {
1307- const int x0 = (x [i ].qs [j ] & 0xf );
1308- const int x1 = (x [i ].qs [j ] >> 4 );
1307+ const int x0 = (x [i ].qs [j ] & 0x0F );
1308+ const int x1 = (x [i ].qs [j ] >> 4 );
13091309
13101310 y [i * qk + j + 0 ] = x0 * d + m ;
13111311 y [i * qk + j + qk /2 ] = x1 * d + m ;
@@ -1330,8 +1330,8 @@ static void dequantize_row_q5_0(const block_q5_0 * restrict x, float * restrict
13301330 const uint8_t xh_0 = ((qh & (1u << (j + 0 ))) >> (j + 0 )) << 4 ;
13311331 const uint8_t xh_1 = ((qh & (1u << (j + 16 ))) >> (j + 12 ));
13321332
1333- const int32_t x0 = ((x [i ].qs [j ] & 0xf ) | xh_0 ) - 16 ;
1334- const int32_t x1 = ((x [i ].qs [j ] >> 4 ) | xh_1 ) - 16 ;
1333+ const int32_t x0 = ((x [i ].qs [j ] & 0x0F ) | xh_0 ) - 16 ;
1334+ const int32_t x1 = ((x [i ].qs [j ] >> 4 ) | xh_1 ) - 16 ;
13351335
13361336 y [i * qk + j + 0 ] = x0 * d ;
13371337 y [i * qk + j + qk /2 ] = x1 * d ;
@@ -1357,8 +1357,8 @@ static void dequantize_row_q5_1(const block_q5_1 * restrict x, float * restrict
13571357 const uint8_t xh_0 = ((qh & (1u << (j + 0 ))) >> (j + 0 )) << 4 ;
13581358 const uint8_t xh_1 = ((qh & (1u << (j + 16 ))) >> (j + 12 ));
13591359
1360- const int x0 = (x [i ].qs [j ] & 0xf ) | xh_0 ;
1361- const int x1 = (x [i ].qs [j ] >> 4 ) | xh_1 ;
1360+ const int x0 = (x [i ].qs [j ] & 0x0F ) | xh_0 ;
1361+ const int x1 = (x [i ].qs [j ] >> 4 ) | xh_1 ;
13621362
13631363 y [i * qk + j + 0 ] = x0 * d + m ;
13641364 y [i * qk + j + qk /2 ] = x1 * d + m ;
@@ -2184,8 +2184,8 @@ static void ggml_vec_dot_q4_0_q8_0(const int n, float * restrict s, const void *
21842184 int sumi = 0 ;
21852185
21862186 for (int j = 0 ; j < qk /2 ; ++ j ) {
2187- const int v0 = (x [i ].qs [j ] & 0xf ) - 8 ;
2188- const int v1 = (x [i ].qs [j ] >> 4 ) - 8 ;
2187+ const int v0 = (x [i ].qs [j ] & 0x0F ) - 8 ;
2188+ const int v1 = (x [i ].qs [j ] >> 4 ) - 8 ;
21892189
21902190 sumi += (v0 * y [i ].qs [j ]) + (v1 * y [i ].qs [j + qk /2 ]);
21912191 }
@@ -2306,8 +2306,8 @@ static void ggml_vec_dot_q4_1_q8_1(const int n, float * restrict s, const void *
23062306 int sumi = 0 ;
23072307
23082308 for (int j = 0 ; j < qk /2 ; ++ j ) {
2309- const int v0 = (x [i ].qs [j ] & 0xf );
2310- const int v1 = (x [i ].qs [j ] >> 4 );
2309+ const int v0 = (x [i ].qs [j ] & 0x0F );
2310+ const int v1 = (x [i ].qs [j ] >> 4 );
23112311
23122312 sumi += (v0 * y [i ].qs [j ]) + (v1 * y [i ].qs [j + qk /2 ]);
23132313 }
@@ -2487,8 +2487,8 @@ static void ggml_vec_dot_q5_0_q8_0(const int n, float * restrict s, const void *
24872487 const uint8_t xh_0 = ((qh & (1u << (j + 0 ))) >> (j + 0 )) << 4 ;
24882488 const uint8_t xh_1 = ((qh & (1u << (j + 16 ))) >> (j + 12 ));
24892489
2490- const int32_t x0 = ((x [i ].qs [j ] & 0xf ) | xh_0 ) - 16 ;
2491- const int32_t x1 = ((x [i ].qs [j ] >> 4 ) | xh_1 ) - 16 ;
2490+ const int32_t x0 = ((x [i ].qs [j ] & 0x0F ) | xh_0 ) - 16 ;
2491+ const int32_t x1 = ((x [i ].qs [j ] >> 4 ) | xh_1 ) - 16 ;
24922492
24932493 sumi += (x0 * y [i ].qs [j ]) + (x1 * y [i ].qs [j + qk /2 ]);
24942494 }
0 commit comments