-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathryu_format.bz
45 lines (38 loc) · 1.4 KB
/
ryu_format.bz
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import std::ryu::common;
import std::ryu::d2s;
import std::ryu::f2s;
import std::ryu::s2d;
import std::ryu::s2f;
import std::ryu::d2fixed;
import std::meta::types;
@symbol_name("d2s_short")
export function d2s_short(x: float64, buffer: *mut uint8) -> *mut uint8
{
return std::ryu::d2s_shortest(x, buffer);
}
@symbol_name("d2exp_short")
export function d2exp_short(x: float64, precision: uint32, buffer: *mut uint8, capital_e: bool, strip_trailing_zeros: bool) -> *mut uint8
{
return std::ryu::d2exp_short(x, precision, buffer, capital_e, strip_trailing_zeros);
}
@symbol_name("d2fixed_short")
export function d2fixed_short(x: float64, precision: uint32, buffer: *mut uint8, strip_trailing_zeros: bool) -> *mut uint8
{
return std::ryu::d2fixed_short(x, precision, buffer, strip_trailing_zeros);
}
@symbol_name("f2s_short")
export function f2s_short(x: float32, buffer: *mut uint8) -> *mut uint8
{
return std::ryu::f2s_shortest(x, buffer);
}
static_assert(std::meta::enum_underlying_type(std::ryu::parse_result) == int32);
@symbol_name("s2d_str")
export function s2d_str(begin: *uint8, end: *uint8, result: *mut float64) -> std::ryu::parse_result
{
return std::ryu::s2d_str(__builtin_str_from_ptrs(begin, end), result);
}
@symbol_name("s2f_str")
export function s2f_str(begin: *uint8, end: *uint8, result: *mut float32) -> std::ryu::parse_result
{
return std::ryu::s2f_str(__builtin_str_from_ptrs(begin, end), result);
}