Spaces:
Running
Running
katsu560
commited on
Commit
·
b2f844a
1
Parent(s):
d44f972
ggml: change inline ggml_fp16_to_fp32, ggml_fp16_t ggml_fp32_to_fp16
Browse files
ggml.c
CHANGED
|
@@ -140,7 +140,7 @@ static inline uint32_t fp32_to_bits(float f) {
|
|
| 140 |
return fp32.as_bits;
|
| 141 |
}
|
| 142 |
|
| 143 |
-
float ggml_fp16_to_fp32(ggml_fp16_t h) {
|
| 144 |
const uint32_t w = (uint32_t) h << 16;
|
| 145 |
const uint32_t sign = w & UINT32_C(0x80000000);
|
| 146 |
const uint32_t two_w = w + w;
|
|
@@ -163,7 +163,7 @@ float ggml_fp16_to_fp32(ggml_fp16_t h) {
|
|
| 163 |
return fp32_from_bits(result);
|
| 164 |
}
|
| 165 |
|
| 166 |
-
ggml_fp16_t ggml_fp32_to_fp16(float f) {
|
| 167 |
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) || defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
| 168 |
const float scale_to_inf = 0x1.0p+112f;
|
| 169 |
const float scale_to_zero = 0x1.0p-110f;
|
|
|
|
| 140 |
return fp32.as_bits;
|
| 141 |
}
|
| 142 |
|
| 143 |
+
inline float ggml_fp16_to_fp32(ggml_fp16_t h) {
|
| 144 |
const uint32_t w = (uint32_t) h << 16;
|
| 145 |
const uint32_t sign = w & UINT32_C(0x80000000);
|
| 146 |
const uint32_t two_w = w + w;
|
|
|
|
| 163 |
return fp32_from_bits(result);
|
| 164 |
}
|
| 165 |
|
| 166 |
+
inline ggml_fp16_t ggml_fp32_to_fp16(float f) {
|
| 167 |
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) || defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
| 168 |
const float scale_to_inf = 0x1.0p+112f;
|
| 169 |
const float scale_to_zero = 0x1.0p-110f;
|