@@ -1283,8 +1283,8 @@ static void dequantize_row_q4_0(const block_q4_0 * restrict x, float * restrict
1283
1283
const float d = x [i ].d ;
1284
1284
1285
1285
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 ;
1288
1288
1289
1289
y [i * qk + j + 0 ] = x0 * d ;
1290
1290
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
1304
1304
const float m = x [i ].m ;
1305
1305
1306
1306
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 );
1309
1309
1310
1310
y [i * qk + j + 0 ] = x0 * d + m ;
1311
1311
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
1330
1330
const uint8_t xh_0 = ((qh & (1u << (j + 0 ))) >> (j + 0 )) << 4 ;
1331
1331
const uint8_t xh_1 = ((qh & (1u << (j + 16 ))) >> (j + 12 ));
1332
1332
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 ;
1335
1335
1336
1336
y [i * qk + j + 0 ] = x0 * d ;
1337
1337
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
1357
1357
const uint8_t xh_0 = ((qh & (1u << (j + 0 ))) >> (j + 0 )) << 4 ;
1358
1358
const uint8_t xh_1 = ((qh & (1u << (j + 16 ))) >> (j + 12 ));
1359
1359
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 ;
1362
1362
1363
1363
y [i * qk + j + 0 ] = x0 * d + m ;
1364
1364
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 *
2184
2184
int sumi = 0 ;
2185
2185
2186
2186
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 ;
2189
2189
2190
2190
sumi += (v0 * y [i ].qs [j ]) + (v1 * y [i ].qs [j + qk /2 ]);
2191
2191
}
@@ -2306,8 +2306,8 @@ static void ggml_vec_dot_q4_1_q8_1(const int n, float * restrict s, const void *
2306
2306
int sumi = 0 ;
2307
2307
2308
2308
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 );
2311
2311
2312
2312
sumi += (v0 * y [i ].qs [j ]) + (v1 * y [i ].qs [j + qk /2 ]);
2313
2313
}
@@ -2487,8 +2487,8 @@ static void ggml_vec_dot_q5_0_q8_0(const int n, float * restrict s, const void *
2487
2487
const uint8_t xh_0 = ((qh & (1u << (j + 0 ))) >> (j + 0 )) << 4 ;
2488
2488
const uint8_t xh_1 = ((qh & (1u << (j + 16 ))) >> (j + 12 ));
2489
2489
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 ;
2492
2492
2493
2493
sumi += (x0 * y [i ].qs [j ]) + (x1 * y [i ].qs [j + qk /2 ]);
2494
2494
}
0 commit comments