Spaces:
Running
Running
ggml : remove inline specifier from fp16 <-> fp32 converters
Browse files
ggml.c
CHANGED
|
@@ -147,7 +147,7 @@ static inline uint32_t fp32_to_bits(float f) {
|
|
| 147 |
return fp32.as_bits;
|
| 148 |
}
|
| 149 |
|
| 150 |
-
|
| 151 |
const uint32_t w = (uint32_t) h << 16;
|
| 152 |
const uint32_t sign = w & UINT32_C(0x80000000);
|
| 153 |
const uint32_t two_w = w + w;
|
|
@@ -170,7 +170,7 @@ inline float ggml_fp16_to_fp32(ggml_fp16_t h) {
|
|
| 170 |
return fp32_from_bits(result);
|
| 171 |
}
|
| 172 |
|
| 173 |
-
|
| 174 |
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) || defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
| 175 |
const float scale_to_inf = 0x1.0p+112f;
|
| 176 |
const float scale_to_zero = 0x1.0p-110f;
|
|
|
|
| 147 |
return fp32.as_bits;
|
| 148 |
}
|
| 149 |
|
| 150 |
+
float ggml_fp16_to_fp32(ggml_fp16_t h) {
|
| 151 |
const uint32_t w = (uint32_t) h << 16;
|
| 152 |
const uint32_t sign = w & UINT32_C(0x80000000);
|
| 153 |
const uint32_t two_w = w + w;
|
|
|
|
| 170 |
return fp32_from_bits(result);
|
| 171 |
}
|
| 172 |
|
| 173 |
+
ggml_fp16_t ggml_fp32_to_fp16(float f) {
|
| 174 |
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) || defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
| 175 |
const float scale_to_inf = 0x1.0p+112f;
|
| 176 |
const float scale_to_zero = 0x1.0p-110f;
|