@@ -1156,8 +1156,8 @@ static void dequantize_row_q4_0(const block_q4_0 * restrict x, float * restrict
1156
1156
const float d = x [i ].d ;
1157
1157
1158
1158
for (int j = 0 ; j < qk /2 ; ++ j ) {
1159
- const int x0 = (x [i ].qs [j ] & 0xf ) - 8 ;
1160
- const int x1 = (x [i ].qs [j ] >> 4 ) - 8 ;
1159
+ const int x0 = (x [i ].qs [j ] & 0x0F ) - 8 ;
1160
+ const int x1 = (x [i ].qs [j ] >> 4 ) - 8 ;
1161
1161
1162
1162
y [i * qk + j + 0 ] = x0 * d ;
1163
1163
y [i * qk + j + qk /2 ] = x1 * d ;
@@ -1177,8 +1177,8 @@ static void dequantize_row_q4_1(const block_q4_1 * restrict x, float * restrict
1177
1177
const float m = x [i ].m ;
1178
1178
1179
1179
for (int j = 0 ; j < qk /2 ; ++ j ) {
1180
- const int x0 = (x [i ].qs [j ] & 0xf );
1181
- const int x1 = (x [i ].qs [j ] >> 4 );
1180
+ const int x0 = (x [i ].qs [j ] & 0x0F );
1181
+ const int x1 = (x [i ].qs [j ] >> 4 );
1182
1182
1183
1183
y [i * qk + j + 0 ] = x0 * d + m ;
1184
1184
y [i * qk + j + qk /2 ] = x1 * d + m ;
@@ -1203,8 +1203,8 @@ static void dequantize_row_q5_0(const block_q5_0 * restrict x, float * restrict
1203
1203
const uint8_t xh_0 = ((qh & (1u << (j + 0 ))) >> (j + 0 )) << 4 ;
1204
1204
const uint8_t xh_1 = ((qh & (1u << (j + 16 ))) >> (j + 12 ));
1205
1205
1206
- const int32_t x0 = ((x [i ].qs [j ] & 0xf ) | xh_0 ) - 16 ;
1207
- const int32_t x1 = ((x [i ].qs [j ] >> 4 ) | xh_1 ) - 16 ;
1206
+ const int32_t x0 = ((x [i ].qs [j ] & 0x0F ) | xh_0 ) - 16 ;
1207
+ const int32_t x1 = ((x [i ].qs [j ] >> 4 ) | xh_1 ) - 16 ;
1208
1208
1209
1209
y [i * qk + j + 0 ] = x0 * d ;
1210
1210
y [i * qk + j + qk /2 ] = x1 * d ;
@@ -1230,8 +1230,8 @@ static void dequantize_row_q5_1(const block_q5_1 * restrict x, float * restrict
1230
1230
const uint8_t xh_0 = ((qh & (1u << (j + 0 ))) >> (j + 0 )) << 4 ;
1231
1231
const uint8_t xh_1 = ((qh & (1u << (j + 16 ))) >> (j + 12 ));
1232
1232
1233
- const int x0 = (x [i ].qs [j ] & 0xf ) | xh_0 ;
1234
- const int x1 = (x [i ].qs [j ] >> 4 ) | xh_1 ;
1233
+ const int x0 = (x [i ].qs [j ] & 0x0F ) | xh_0 ;
1234
+ const int x1 = (x [i ].qs [j ] >> 4 ) | xh_1 ;
1235
1235
1236
1236
y [i * qk + j + 0 ] = x0 * d + m ;
1237
1237
y [i * qk + j + qk /2 ] = x1 * d + m ;
@@ -2057,8 +2057,8 @@ static void ggml_vec_dot_q4_0_q8_0(const int n, float * restrict s, const void *
2057
2057
int sumi = 0 ;
2058
2058
2059
2059
for (int j = 0 ; j < qk /2 ; ++ j ) {
2060
- const int v0 = (x [i ].qs [j ] & 0xf ) - 8 ;
2061
- const int v1 = (x [i ].qs [j ] >> 4 ) - 8 ;
2060
+ const int v0 = (x [i ].qs [j ] & 0x0F ) - 8 ;
2061
+ const int v1 = (x [i ].qs [j ] >> 4 ) - 8 ;
2062
2062
2063
2063
sumi += (v0 * y [i ].qs [j ]) + (v1 * y [i ].qs [j + qk /2 ]);
2064
2064
}
@@ -2179,8 +2179,8 @@ static void ggml_vec_dot_q4_1_q8_1(const int n, float * restrict s, const void *
2179
2179
int sumi = 0 ;
2180
2180
2181
2181
for (int j = 0 ; j < qk /2 ; ++ j ) {
2182
- const int v0 = (x [i ].qs [j ] & 0xf );
2183
- const int v1 = (x [i ].qs [j ] >> 4 );
2182
+ const int v0 = (x [i ].qs [j ] & 0x0F );
2183
+ const int v1 = (x [i ].qs [j ] >> 4 );
2184
2184
2185
2185
sumi += (v0 * y [i ].qs [j ]) + (v1 * y [i ].qs [j + qk /2 ]);
2186
2186
}
@@ -2360,8 +2360,8 @@ static void ggml_vec_dot_q5_0_q8_0(const int n, float * restrict s, const void *
2360
2360
const uint8_t xh_0 = ((qh & (1u << (j + 0 ))) >> (j + 0 )) << 4 ;
2361
2361
const uint8_t xh_1 = ((qh & (1u << (j + 16 ))) >> (j + 12 ));
2362
2362
2363
- const int32_t x0 = ((x [i ].qs [j ] & 0xf ) | xh_0 ) - 16 ;
2364
- const int32_t x1 = ((x [i ].qs [j ] >> 4 ) | xh_1 ) - 16 ;
2363
+ const int32_t x0 = ((x [i ].qs [j ] & 0x0F ) | xh_0 ) - 16 ;
2364
+ const int32_t x1 = ((x [i ].qs [j ] >> 4 ) | xh_1 ) - 16 ;
2365
2365
2366
2366
sumi += (x0 * y [i ].qs [j ]) + (x1 * y [i ].qs [j + qk /2 ]);
2367
2367
}
0 commit comments