aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorFeoramund <161657516+Feoramund@users.noreply.github.com>2025-06-05 16:29:41 -0400
committerFeoramund <161657516+Feoramund@users.noreply.github.com>2025-06-05 16:56:00 -0400
commitb7de15caa342fd81fb203015e2fd22a82e523342 (patch)
tree9224c1213337d8e834b46e7d19bcf5492838246a /core
parent90a1b0ec4b5a0630be329d086f4c08a7c54a74e7 (diff)
Clarify `strconv.append_*` to `strconv.write_*`
Diffstat (limited to 'core')
-rw-r--r--core/encoding/cbor/cbor.odin6
-rw-r--r--core/encoding/json/marshal.odin8
-rw-r--r--core/fmt/fmt.odin8
-rw-r--r--core/io/util.odin16
-rw-r--r--core/math/fixed/fixed.odin6
-rw-r--r--core/net/url.odin2
-rw-r--r--core/os/os.odin2
-rw-r--r--core/os/os2/file_util.odin2
-rw-r--r--core/strconv/integers.odin14
-rw-r--r--core/strconv/strconv.odin84
-rw-r--r--core/strings/builder.odin12
11 files changed, 80 insertions, 80 deletions
diff --git a/core/encoding/cbor/cbor.odin b/core/encoding/cbor/cbor.odin
index 8eb829ed3..1fb7c34ab 100644
--- a/core/encoding/cbor/cbor.odin
+++ b/core/encoding/cbor/cbor.odin
@@ -385,17 +385,17 @@ to_diagnostic_format_writer :: proc(w: io.Writer, val: Value, padding := 0) -> i
// which we want for the diagnostic format.
case f16:
buf: [64]byte
- str := strconv.append_float(buf[:], f64(v), 'f', 2*size_of(f16), 8*size_of(f16))
+ str := strconv.write_float(buf[:], f64(v), 'f', 2*size_of(f16), 8*size_of(f16))
if str[0] == '+' && str != "+Inf" { str = str[1:] }
io.write_string(w, str) or_return
case f32:
buf: [128]byte
- str := strconv.append_float(buf[:], f64(v), 'f', 2*size_of(f32), 8*size_of(f32))
+ str := strconv.write_float(buf[:], f64(v), 'f', 2*size_of(f32), 8*size_of(f32))
if str[0] == '+' && str != "+Inf" { str = str[1:] }
io.write_string(w, str) or_return
case f64:
buf: [256]byte
- str := strconv.append_float(buf[:], f64(v), 'f', 2*size_of(f64), 8*size_of(f64))
+ str := strconv.write_float(buf[:], f64(v), 'f', 2*size_of(f64), 8*size_of(f64))
if str[0] == '+' && str != "+Inf" { str = str[1:] }
io.write_string(w, str) or_return
diff --git a/core/encoding/json/marshal.odin b/core/encoding/json/marshal.odin
index 020facd14..ebb9a639c 100644
--- a/core/encoding/json/marshal.odin
+++ b/core/encoding/json/marshal.odin
@@ -108,13 +108,13 @@ marshal_to_writer :: proc(w: io.Writer, v: any, opt: ^Marshal_Options) -> (err:
if opt.write_uint_as_hex && (opt.spec == .JSON5 || opt.spec == .MJSON) {
switch i in a {
case u8, u16, u32, u64, u128:
- s = strconv.append_bits_128(buf[:], u, 16, info.signed, 8*ti.size, "0123456789abcdef", { .Prefix })
+ s = strconv.write_bits_128(buf[:], u, 16, info.signed, 8*ti.size, "0123456789abcdef", { .Prefix })
case:
- s = strconv.append_bits_128(buf[:], u, 10, info.signed, 8*ti.size, "0123456789", nil)
+ s = strconv.write_bits_128(buf[:], u, 10, info.signed, 8*ti.size, "0123456789", nil)
}
} else {
- s = strconv.append_bits_128(buf[:], u, 10, info.signed, 8*ti.size, "0123456789", nil)
+ s = strconv.write_bits_128(buf[:], u, 10, info.signed, 8*ti.size, "0123456789", nil)
}
io.write_string(w, s) or_return
@@ -286,7 +286,7 @@ marshal_to_writer :: proc(w: io.Writer, v: any, opt: ^Marshal_Options) -> (err:
case runtime.Type_Info_Integer:
buf: [40]byte
u := cast_any_int_to_u128(ka)
- name = strconv.append_bits_128(buf[:], u, 10, info.signed, 8*kti.size, "0123456789", nil)
+ name = strconv.write_bits_128(buf[:], u, 10, info.signed, 8*kti.size, "0123456789", nil)
opt_write_key(w, opt, name) or_return
case: return .Unsupported_Type
diff --git a/core/fmt/fmt.odin b/core/fmt/fmt.odin
index 9c07847dd..0f6470cca 100644
--- a/core/fmt/fmt.odin
+++ b/core/fmt/fmt.odin
@@ -1122,7 +1122,7 @@ _fmt_int :: proc(fi: ^Info, u: u64, base: int, is_signed: bool, bit_size: int, d
flags: strconv.Int_Flags
if fi.hash && !fi.zero && start == 0 { flags += {.Prefix} }
if fi.plus { flags += {.Plus} }
- s := strconv.append_bits(buf[start:], u, base, is_signed, bit_size, digits, flags)
+ s := strconv.write_bits(buf[start:], u, base, is_signed, bit_size, digits, flags)
prev_zero := fi.zero
defer fi.zero = prev_zero
fi.zero = false
@@ -1207,7 +1207,7 @@ _fmt_int_128 :: proc(fi: ^Info, u: u128, base: int, is_signed: bool, bit_size: i
flags: strconv.Int_Flags
if fi.hash && !fi.zero && start == 0 { flags += {.Prefix} }
if fi.plus { flags += {.Plus} }
- s := strconv.append_bits_128(buf[start:], u, base, is_signed, bit_size, digits, flags)
+ s := strconv.write_bits_128(buf[start:], u, base, is_signed, bit_size, digits, flags)
if fi.hash && fi.zero && fi.indent == 0 {
c: byte = 0
@@ -1272,7 +1272,7 @@ _fmt_memory :: proc(fi: ^Info, u: u64, is_signed: bool, bit_size: int, units: st
}
buf: [256]byte
- str := strconv.append_float(buf[:], amt, 'f', prec, 64)
+ str := strconv.write_float(buf[:], amt, 'f', prec, 64)
// Add the unit at the end.
copy(buf[len(str):], units[off:off+unit_len])
@@ -1424,7 +1424,7 @@ _fmt_float_as :: proc(fi: ^Info, v: f64, bit_size: int, verb: rune, float_fmt: b
buf: [386]byte
// Can return "NaN", "+Inf", "-Inf", "+<value>", "-<value>".
- str := strconv.append_float(buf[:], v, float_fmt, prec, bit_size)
+ str := strconv.write_float(buf[:], v, float_fmt, prec, bit_size)
if !fi.plus {
// Strip sign from "+<value>" but not "+Inf".
diff --git a/core/io/util.odin b/core/io/util.odin
index fdbbd5b9f..fa98e007b 100644
--- a/core/io/util.odin
+++ b/core/io/util.odin
@@ -22,12 +22,12 @@ write_ptr_at :: proc(w: Writer_At, p: rawptr, byte_size: int, offset: i64, n_wri
write_u64 :: proc(w: Writer, i: u64, base: int = 10, n_written: ^int = nil) -> (n: int, err: Error) {
buf: [32]byte
- s := strconv.append_bits(buf[:], i, base, false, 64, strconv.digits, nil)
+ s := strconv.write_bits(buf[:], i, base, false, 64, strconv.digits, nil)
return write_string(w, s, n_written)
}
write_i64 :: proc(w: Writer, i: i64, base: int = 10, n_written: ^int = nil) -> (n: int, err: Error) {
buf: [32]byte
- s := strconv.append_bits(buf[:], u64(i), base, true, 64, strconv.digits, nil)
+ s := strconv.write_bits(buf[:], u64(i), base, true, 64, strconv.digits, nil)
return write_string(w, s, n_written)
}
@@ -40,18 +40,18 @@ write_int :: proc(w: Writer, i: int, base: int = 10, n_written: ^int = nil) -> (
write_u128 :: proc(w: Writer, i: u128, base: int = 10, n_written: ^int = nil) -> (n: int, err: Error) {
buf: [39]byte
- s := strconv.append_bits_128(buf[:], i, base, false, 128, strconv.digits, nil)
+ s := strconv.write_bits_128(buf[:], i, base, false, 128, strconv.digits, nil)
return write_string(w, s, n_written)
}
write_i128 :: proc(w: Writer, i: i128, base: int = 10, n_written: ^int = nil) -> (n: int, err: Error) {
buf: [40]byte
- s := strconv.append_bits_128(buf[:], u128(i), base, true, 128, strconv.digits, nil)
+ s := strconv.write_bits_128(buf[:], u128(i), base, true, 128, strconv.digits, nil)
return write_string(w, s, n_written)
}
write_f16 :: proc(w: Writer, val: f16, n_written: ^int = nil) -> (n: int, err: Error) {
buf: [386]byte
- str := strconv.append_float(buf[1:], f64(val), 'f', 2*size_of(val), 8*size_of(val))
+ str := strconv.write_float(buf[1:], f64(val), 'f', 2*size_of(val), 8*size_of(val))
s := buf[:len(str)+1]
if s[1] == '+' || s[1] == '-' {
s = s[1:]
@@ -67,7 +67,7 @@ write_f16 :: proc(w: Writer, val: f16, n_written: ^int = nil) -> (n: int, err: E
write_f32 :: proc(w: Writer, val: f32, n_written: ^int = nil) -> (n: int, err: Error) {
buf: [386]byte
- str := strconv.append_float(buf[1:], f64(val), 'f', 2*size_of(val), 8*size_of(val))
+ str := strconv.write_float(buf[1:], f64(val), 'f', 2*size_of(val), 8*size_of(val))
s := buf[:len(str)+1]
if s[1] == '+' || s[1] == '-' {
s = s[1:]
@@ -83,7 +83,7 @@ write_f32 :: proc(w: Writer, val: f32, n_written: ^int = nil) -> (n: int, err: E
write_f64 :: proc(w: Writer, val: f64, n_written: ^int = nil) -> (n: int, err: Error) {
buf: [386]byte
- str := strconv.append_float(buf[1:], val, 'f', 2*size_of(val), 8*size_of(val))
+ str := strconv.write_float(buf[1:], val, 'f', 2*size_of(val), 8*size_of(val))
s := buf[:len(str)+1]
if s[1] == '+' || s[1] == '-' {
s = s[1:]
@@ -130,7 +130,7 @@ write_encoded_rune :: proc(w: Writer, r: rune, write_quote := true, n_written: ^
write_string(w, `\x`, &n) or_return
buf: [2]byte
- s := strconv.append_bits(buf[:], u64(r), 16, true, 64, strconv.digits, nil)
+ s := strconv.write_bits(buf[:], u64(r), 16, true, 64, strconv.digits, nil)
switch len(s) {
case 0:
write_string(w, "00", &n) or_return
diff --git a/core/math/fixed/fixed.odin b/core/math/fixed/fixed.odin
index b23090307..119e727a7 100644
--- a/core/math/fixed/fixed.odin
+++ b/core/math/fixed/fixed.odin
@@ -124,16 +124,16 @@ append :: proc(dst: []byte, x: $T/Fixed($Backing, $Fraction_Width)) -> string {
when size_of(Backing) < 16 {
T :: u64
- append_uint :: strconv.append_uint
+ write_uint :: strconv.write_uint
} else {
T :: u128
- append_uint :: strconv.append_u128
+ write_uint :: strconv.write_u128
}
integer := T(x.i) >> Fraction_Width
fraction := T(x.i) & (1<<Fraction_Width - 1)
- s := append_uint(buf[i:], integer, 10)
+ s := write_uint(buf[i:], integer, 10)
i += len(s)
if fraction != 0 {
buf[i] = '.'
diff --git a/core/net/url.odin b/core/net/url.odin
index aadcf5e48..41c315585 100644
--- a/core/net/url.odin
+++ b/core/net/url.odin
@@ -125,7 +125,7 @@ percent_encode :: proc(s: string, allocator := context.allocator) -> string {
bytes, n := utf8.encode_rune(ch)
for byte in bytes[:n] {
buf: [2]u8 = ---
- t := strconv.append_int(buf[:], i64(byte), 16)
+ t := strconv.write_int(buf[:], i64(byte), 16)
strings.write_rune(&b, '%')
strings.write_string(&b, t)
}
diff --git a/core/os/os.odin b/core/os/os.odin
index 30b86d4cd..fde48fbf4 100644
--- a/core/os/os.odin
+++ b/core/os/os.odin
@@ -57,7 +57,7 @@ write_encoded_rune :: proc(f: Handle, r: rune) -> (n: int, err: Error) {
if r < 32 {
if wrap(write_string(f, "\\x"), &n, &err) { return }
b: [2]byte
- s := strconv.append_bits(b[:], u64(r), 16, true, 64, strconv.digits, nil)
+ s := strconv.write_bits(b[:], u64(r), 16, true, 64, strconv.digits, nil)
switch len(s) {
case 0: if wrap(write_string(f, "00"), &n, &err) { return }
case 1: if wrap(write_rune(f, '0'), &n, &err) { return }
diff --git a/core/os/os2/file_util.odin b/core/os/os2/file_util.odin
index 8af46fab3..407c38f88 100644
--- a/core/os/os2/file_util.odin
+++ b/core/os/os2/file_util.odin
@@ -59,7 +59,7 @@ write_encoded_rune :: proc(f: ^File, r: rune) -> (n: int, err: Error) {
if r < 32 {
if wrap(write_string(f, "\\x"), &n, &err) { return }
b: [2]byte
- s := strconv.append_bits(b[:], u64(r), 16, true, 64, strconv.digits, nil)
+ s := strconv.write_bits(b[:], u64(r), 16, true, 64, strconv.digits, nil)
switch len(s) {
case 0: if wrap(write_string(f, "00"), &n, &err) { return }
case 1: if wrap(write_rune(f, '0'), &n, &err) { return }
diff --git a/core/strconv/integers.odin b/core/strconv/integers.odin
index 98a432ac5..0db110d10 100644
--- a/core/strconv/integers.odin
+++ b/core/strconv/integers.odin
@@ -48,7 +48,7 @@ is_integer_negative :: proc(x: u64, is_signed: bool, bit_size: int) -> (u: u64,
return
}
/*
-Appends the string representation of an integer to a buffer with specified base, flags, and digit set.
+Writes the string representation of an integer to a buffer with specified base, flags, and digit set.
**Inputs**
- buf: The buffer to append the integer representation to
@@ -62,9 +62,9 @@ Appends the string representation of an integer to a buffer with specified base,
**Returns**
- The string containing the integer representation appended to the buffer
*/
-append_bits :: proc(buf: []byte, x: u64, base: int, is_signed: bool, bit_size: int, digits: string, flags: Int_Flags) -> string {
+write_bits :: proc(buf: []byte, x: u64, base: int, is_signed: bool, bit_size: int, digits: string, flags: Int_Flags) -> string {
if base < 2 || base > MAX_BASE {
- panic("strconv: illegal base passed to append_bits")
+ panic("strconv: illegal base passed to write_bits")
}
a: [129]byte
@@ -146,7 +146,7 @@ is_integer_negative_128 :: proc(x: u128, is_signed: bool, bit_size: int) -> (u:
return
}
/*
-Appends the string representation of a 128-bit integer to a buffer with specified base, flags, and digit set.
+Writes the string representation of a 128-bit integer to a buffer with specified base, flags, and digit set.
**Inputs**
- buf: The buffer to append the integer representation to
@@ -158,11 +158,11 @@ Appends the string representation of a 128-bit integer to a buffer with specifie
- flags: The Int_Flags bit set to control integer formatting
**Returns**
-- The string containing the integer representation appended to the buffer
+- The string containing the integer representation written to the buffer
*/
-append_bits_128 :: proc(buf: []byte, x: u128, base: int, is_signed: bool, bit_size: int, digits: string, flags: Int_Flags) -> string {
+write_bits_128 :: proc(buf: []byte, x: u128, base: int, is_signed: bool, bit_size: int, digits: string, flags: Int_Flags) -> string {
if base < 2 || base > MAX_BASE {
- panic("strconv: illegal base passed to append_bits")
+ panic("strconv: illegal base passed to write_bits")
}
a: [140]byte
diff --git a/core/strconv/strconv.odin b/core/strconv/strconv.odin
index 4cecd1911..99a290d83 100644
--- a/core/strconv/strconv.odin
+++ b/core/strconv/strconv.odin
@@ -1451,19 +1451,19 @@ parse_quaternion64 :: proc(str: string, n: ^int = nil) -> (value: quaternion64,
return cast(quaternion64)v, ok
}
/*
-Appends a boolean value as a string to the given buffer
+Writes a boolean value as a string to the given buffer
**Inputs**
-- buf: The buffer to append the boolean value to
-- b: The boolean value to be appended
+- buf: The buffer to write the boolean value to
+- b: The boolean value to be written
Example:
import "core:fmt"
import "core:strconv"
- append_bool_example :: proc() {
+ write_bool_example :: proc() {
buf: [6]byte
- result := strconv.append_bool(buf[:], true)
+ result := strconv.write_bool(buf[:], true)
fmt.println(result, buf)
}
@@ -1472,9 +1472,9 @@ Output:
true [116, 114, 117, 101, 0, 0]
**Returns**
-- The resulting string after appending the boolean value
+- The resulting string after writing the boolean value
*/
-append_bool :: proc(buf: []byte, b: bool) -> string {
+write_bool :: proc(buf: []byte, b: bool) -> string {
n := 0
if b {
n = copy(buf, "true")
@@ -1484,20 +1484,20 @@ append_bool :: proc(buf: []byte, b: bool) -> string {
return string(buf[:n])
}
/*
-Appends an unsigned integer value as a string to the given buffer with the specified base
+Writes an unsigned integer value as a string to the given buffer with the specified base
**Inputs**
-- buf: The buffer to append the unsigned integer value to
-- u: The unsigned integer value to be appended
+- buf: The buffer to write the unsigned integer value to
+- u: The unsigned integer value to be written
- base: The base to use for converting the integer value
Example:
import "core:fmt"
import "core:strconv"
- append_uint_example :: proc() {
+ write_uint_example :: proc() {
buf: [4]byte
- result := strconv.append_uint(buf[:], 42, 16)
+ result := strconv.write_uint(buf[:], 42, 16)
fmt.println(result, buf)
}
@@ -1506,26 +1506,26 @@ Output:
2a [50, 97, 0, 0]
**Returns**
-- The resulting string after appending the unsigned integer value
+- The resulting string after writing the unsigned integer value
*/
-append_uint :: proc(buf: []byte, u: u64, base: int) -> string {
- return append_bits(buf, u, base, false, 8*size_of(uint), digits, nil)
+write_uint :: proc(buf: []byte, u: u64, base: int) -> string {
+ return write_bits(buf, u, base, false, 8*size_of(uint), digits, nil)
}
/*
-Appends a signed integer value as a string to the given buffer with the specified base
+Writes a signed integer value as a string to the given buffer with the specified base
**Inputs**
-- buf: The buffer to append the signed integer value to
-- i: The signed integer value to be appended
+- buf: The buffer to write the signed integer value to
+- i: The signed integer value to be written
- base: The base to use for converting the integer value
Example:
import "core:fmt"
import "core:strconv"
- append_int_example :: proc() {
+ write_int_example :: proc() {
buf: [4]byte
- result := strconv.append_int(buf[:], -42, 10)
+ result := strconv.write_int(buf[:], -42, 10)
fmt.println(result, buf)
}
@@ -1534,16 +1534,16 @@ Output:
-42 [45, 52, 50, 0]
**Returns**
-- The resulting string after appending the signed integer value
+- The resulting string after writing the signed integer value
*/
-append_int :: proc(buf: []byte, i: i64, base: int) -> string {
- return append_bits(buf, u64(i), base, true, 8*size_of(int), digits, nil)
+write_int :: proc(buf: []byte, i: i64, base: int) -> string {
+ return write_bits(buf, u64(i), base, true, 8*size_of(int), digits, nil)
}
-append_u128 :: proc(buf: []byte, u: u128, base: int) -> string {
- return append_bits_128(buf, u, base, false, 8*size_of(uint), digits, nil)
+write_u128 :: proc(buf: []byte, u: u128, base: int) -> string {
+ return write_bits_128(buf, u, base, false, 8*size_of(uint), digits, nil)
}
/*
@@ -1571,7 +1571,7 @@ Output:
- The resulting string after converting the integer value
*/
itoa :: proc(buf: []byte, i: int) -> string {
- return append_int(buf, i64(i), 10)
+ return write_int(buf, i64(i), 10)
}
/*
Converts a string to an integer value
@@ -1623,14 +1623,14 @@ atof :: proc(s: string) -> f64 {
v, _ := parse_f64(s)
return v
}
-// Alias to `append_float`
-ftoa :: append_float
+// Alias to `write_float`
+ftoa :: write_float
/*
-Appends a float64 value as a string to the given buffer with the specified format and precision
+Writes a float64 value as a string to the given buffer with the specified format and precision
**Inputs**
-- buf: The buffer to append the float64 value to
-- f: The float64 value to be appended
+- buf: The buffer to write the float64 value to
+- f: The float64 value to be written
- fmt: The byte specifying the format to use for the conversion
- prec: The precision to use for the conversion
- bit_size: The size of the float in bits (32 or 64)
@@ -1639,9 +1639,9 @@ Example:
import "core:fmt"
import "core:strconv"
- append_float_example :: proc() {
+ write_float_example :: proc() {
buf: [8]byte
- result := strconv.append_float(buf[:], 3.14159, 'f', 2, 64)
+ result := strconv.write_float(buf[:], 3.14159, 'f', 2, 64)
fmt.println(result, buf)
}
@@ -1650,16 +1650,16 @@ Output:
+3.14 [43, 51, 46, 49, 52, 0, 0, 0]
**Returns**
-- The resulting string after appending the float
+- The resulting string after writing the float
*/
-append_float :: proc(buf: []byte, f: f64, fmt: byte, prec, bit_size: int) -> string {
+write_float :: proc(buf: []byte, f: f64, fmt: byte, prec, bit_size: int) -> string {
return string(generic_ftoa(buf, f, fmt, prec, bit_size))
}
/*
-Appends a quoted string representation of the input string to a given byte slice and returns the result as a string
+Writes a quoted string representation of the input string to a given byte slice and returns the result as a string
**Inputs**
-- buf: The byte slice to which the quoted string will be appended
+- buf: The byte slice to which the quoted string will be written
- str: The input string to be quoted
!! ISSUE !! NOT EXPECTED -- "\"hello\"" was expected
@@ -1679,7 +1679,7 @@ Output:
"'h''e''l''l''o'" [34, 39, 104, 39, 39, 101, 39, 39, 108, 39, 39, 108, 39, 39, 111, 39, 34, 0, 0, 0]
**Returns**
-- The resulting string after appending the quoted string representation
+- The resulting string after writing the quoted string representation
*/
quote :: proc(buf: []byte, str: string) -> string {
write_byte :: proc(buf: []byte, i: ^int, bytes: ..byte) {
@@ -1719,10 +1719,10 @@ quote :: proc(buf: []byte, str: string) -> string {
return string(buf[:i])
}
/*
-Appends a quoted rune representation of the input rune to a given byte slice and returns the result as a string
+Writes a quoted rune representation of the input rune to a given byte slice and returns the result as a string
**Inputs**
-- buf: The byte slice to which the quoted rune will be appended
+- buf: The byte slice to which the quoted rune will be written
- r: The input rune to be quoted
Example:
@@ -1740,7 +1740,7 @@ Output:
'A' [39, 65, 39, 0]
**Returns**
-- The resulting string after appending the quoted rune representation
+- The resulting string after writing the quoted rune representation
*/
quote_rune :: proc(buf: []byte, r: rune) -> string {
write_byte :: proc(buf: []byte, i: ^int, bytes: ..byte) {
@@ -1783,7 +1783,7 @@ quote_rune :: proc(buf: []byte, r: rune) -> string {
if r < 32 {
write_string(buf, &i, "\\x")
b: [2]byte
- s := append_bits(b[:], u64(r), 16, true, 64, digits, nil)
+ s := write_bits(b[:], u64(r), 16, true, 64, digits, nil)
switch len(s) {
case 0: write_string(buf, &i, "00")
case 1: write_rune(buf, &i, '0')
diff --git a/core/strings/builder.odin b/core/strings/builder.odin
index 05382f04e..b1180d5e9 100644
--- a/core/strings/builder.odin
+++ b/core/strings/builder.odin
@@ -675,7 +675,7 @@ Returns:
*/
write_float :: proc(b: ^Builder, f: f64, fmt: byte, prec, bit_size: int, always_signed := false) -> (n: int) {
buf: [384]byte
- s := strconv.append_float(buf[:], f, fmt, prec, bit_size)
+ s := strconv.write_float(buf[:], f, fmt, prec, bit_size)
// If the result starts with a `+` then unless we always want signed results,
// we skip it unless it's followed by an `I` (because of +Inf).
if !always_signed && (buf[0] == '+' && buf[1] != 'I') {
@@ -699,7 +699,7 @@ Returns:
*/
write_f16 :: proc(b: ^Builder, f: f16, fmt: byte, always_signed := false) -> (n: int) {
buf: [384]byte
- s := strconv.append_float(buf[:], f64(f), fmt, 2*size_of(f), 8*size_of(f))
+ s := strconv.write_float(buf[:], f64(f), fmt, 2*size_of(f), 8*size_of(f))
if !always_signed && (buf[0] == '+' && buf[1] != 'I') {
s = s[1:]
}
@@ -739,7 +739,7 @@ Output:
*/
write_f32 :: proc(b: ^Builder, f: f32, fmt: byte, always_signed := false) -> (n: int) {
buf: [384]byte
- s := strconv.append_float(buf[:], f64(f), fmt, 2*size_of(f), 8*size_of(f))
+ s := strconv.write_float(buf[:], f64(f), fmt, 2*size_of(f), 8*size_of(f))
if !always_signed && (buf[0] == '+' && buf[1] != 'I') {
s = s[1:]
}
@@ -761,7 +761,7 @@ Returns:
*/
write_f64 :: proc(b: ^Builder, f: f64, fmt: byte, always_signed := false) -> (n: int) {
buf: [384]byte
- s := strconv.append_float(buf[:], f64(f), fmt, 2*size_of(f), 8*size_of(f))
+ s := strconv.write_float(buf[:], f64(f), fmt, 2*size_of(f), 8*size_of(f))
if !always_signed && (buf[0] == '+' && buf[1] != 'I') {
s = s[1:]
}
@@ -782,7 +782,7 @@ Returns:
*/
write_u64 :: proc(b: ^Builder, i: u64, base: int = 10) -> (n: int) {
buf: [32]byte
- s := strconv.append_bits(buf[:], i, base, false, 64, strconv.digits, nil)
+ s := strconv.write_bits(buf[:], i, base, false, 64, strconv.digits, nil)
return write_string(b, s)
}
/*
@@ -800,7 +800,7 @@ Returns:
*/
write_i64 :: proc(b: ^Builder, i: i64, base: int = 10) -> (n: int) {
buf: [32]byte
- s := strconv.append_bits(buf[:], u64(i), base, true, 64, strconv.digits, nil)
+ s := strconv.write_bits(buf[:], u64(i), base, true, 64, strconv.digits, nil)
return write_string(b, s)
}
/*