backporting: remove redefinition of strconv__Float64u
parent
3d0f4fd756
commit
317a9bae5f
|
@ -1,3 +1,4 @@
|
|||
module strconv
|
||||
/*
|
||||
|
||||
atof util
|
||||
|
@ -17,17 +18,6 @@ Grzegorz Kraszewski krashan@teleinfo.pb.edu.pl
|
|||
URL: http://krashan.ppa.pl/articles/stringtofloat/
|
||||
Original license: MIT
|
||||
|
||||
*/
|
||||
module strconv
|
||||
|
||||
union Float64u {
|
||||
mut:
|
||||
f f64
|
||||
u u64
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
96 bit operation utilities
|
||||
Note: when u128 will be available these function can be refactored
|
||||
|
||||
|
@ -162,13 +152,6 @@ Support struct
|
|||
|
||||
*/
|
||||
|
||||
// The structure is filled by parser, then given to converter.
|
||||
pub struct PrepNumber {
|
||||
pub mut:
|
||||
negative bool // 0 if positive number, 1 if negative
|
||||
exponent int // power of 10 exponent
|
||||
mantissa u64 // integer mantissa
|
||||
}
|
||||
/*
|
||||
|
||||
String parser
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
module strconv
|
||||
|
||||
/*
|
||||
|
||||
atof util
|
||||
|
@ -16,14 +18,6 @@ Know limitation:
|
|||
|
||||
*/
|
||||
|
||||
module strconv
|
||||
|
||||
union Float64u {
|
||||
mut:
|
||||
f f64
|
||||
u u64
|
||||
}
|
||||
|
||||
// atof_quick return a f64 number from a string in a quick way
|
||||
pub fn atof_quick(s string) f64 {
|
||||
mut f := Float64u{} // result
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
module strconv
|
||||
// Copyright (c) 2019-2020 Alexander Medvednikov. All rights reserved.
|
||||
// Use of this source code is governed by an MIT license
|
||||
// that can be found in the LICENSE file.
|
||||
// TODO: use optionals, or some way to return default with error.
|
||||
module strconv
|
||||
|
||||
const (
|
||||
// int_size is the size in bits of an int or uint value.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
module strconv
|
||||
|
||||
/*
|
||||
|
||||
f32 to string
|
||||
|
@ -17,21 +19,7 @@ inspired by the Go version here:
|
|||
https://github.com/cespare/ryu/tree/ba56a33f39e3bbbfa409095d0f9ae168a595feea
|
||||
|
||||
*/
|
||||
module strconv
|
||||
|
||||
// dec32 is a floating decimal type representing m * 10^e.
|
||||
struct Dec32 {
|
||||
mut:
|
||||
m u32
|
||||
e int
|
||||
}
|
||||
|
||||
// support union for convert f32 to u32
|
||||
union Uf32 {
|
||||
mut:
|
||||
f f32
|
||||
u u32
|
||||
}
|
||||
|
||||
// pow of ten table used by n_digit reduction
|
||||
const(
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
module strconv
|
||||
|
||||
/*
|
||||
|
||||
f32 to string
|
||||
|
@ -17,27 +19,6 @@ inspired by the Go version here:
|
|||
https://github.com/cespare/ryu/tree/ba56a33f39e3bbbfa409095d0f9ae168a595feea
|
||||
|
||||
*/
|
||||
module strconv
|
||||
|
||||
struct Uint128 {
|
||||
mut:
|
||||
lo u64
|
||||
hi u64
|
||||
}
|
||||
|
||||
// dec64 is a floating decimal type representing m * 10^e.
|
||||
struct Dec64 {
|
||||
mut:
|
||||
m u64
|
||||
e int
|
||||
}
|
||||
|
||||
// support union for convert f64 to u64
|
||||
union Uf64 {
|
||||
mut:
|
||||
f f64
|
||||
u u64
|
||||
}
|
||||
|
||||
// pow of ten table used by n_digit reduction
|
||||
const(
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
module strconv
|
||||
|
||||
/*
|
||||
|
||||
printf/sprintf V implementation
|
||||
|
@ -9,7 +11,6 @@ that can be found in the LICENSE file.
|
|||
This file contains the printf/sprintf functions
|
||||
|
||||
*/
|
||||
module strconv
|
||||
|
||||
import strings
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
module strconv
|
||||
|
||||
/*
|
||||
|
||||
f32/f64 ftoa functions
|
||||
|
@ -17,7 +19,6 @@ inspired by the Go version here:
|
|||
https://github.com/cespare/ryu/tree/ba56a33f39e3bbbfa409095d0f9ae168a595feea
|
||||
|
||||
*/
|
||||
module strconv
|
||||
|
||||
[inline]
|
||||
pub fn ftoa_64(f f64) string {
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
module strconv
|
||||
|
||||
// The structure is filled by parser, then given to converter.
|
||||
pub struct PrepNumber {
|
||||
pub mut:
|
||||
negative bool // 0 if positive number, 1 if negative
|
||||
exponent int // power of 10 exponent
|
||||
mantissa u64 // integer mantissa
|
||||
}
|
||||
|
||||
// dec32 is a floating decimal type representing m * 10^e.
|
||||
struct Dec32 {
|
||||
mut:
|
||||
m u32
|
||||
e int
|
||||
}
|
||||
|
||||
// dec64 is a floating decimal type representing m * 10^e.
|
||||
struct Dec64 {
|
||||
mut:
|
||||
m u64
|
||||
e int
|
||||
}
|
||||
|
||||
struct Uint128 {
|
||||
mut:
|
||||
lo u64
|
||||
hi u64
|
||||
}
|
||||
|
||||
// support union for convert f32 to u32
|
||||
union Uf32 {
|
||||
mut:
|
||||
f f32
|
||||
u u32
|
||||
}
|
||||
|
||||
// support union for convert f64 to u64
|
||||
union Uf64 {
|
||||
mut:
|
||||
f f64
|
||||
u u64
|
||||
}
|
||||
|
||||
union Float64u {
|
||||
mut:
|
||||
f f64
|
||||
u u64
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
module strconv
|
||||
|
||||
/*
|
||||
|
||||
f32/f64 to string utilities
|
||||
|
@ -17,7 +19,6 @@ inspired by the Go version here:
|
|||
https://github.com/cespare/ryu/tree/ba56a33f39e3bbbfa409095d0f9ae168a595feea
|
||||
|
||||
*/
|
||||
module strconv
|
||||
|
||||
import math.bits
|
||||
|
||||
|
|
|
@ -204,6 +204,7 @@ pub fn cgen(files []ast.File, table &table.Table, pref &pref.Preferences) string
|
|||
//
|
||||
mut b := strings.new_builder(250000)
|
||||
b.write(g.hashes())
|
||||
b.writeln('\n// V comptime_defines:')
|
||||
b.write(g.comptime_defines.str())
|
||||
b.writeln('\n// V typedefs:')
|
||||
b.write(g.typedefs.str())
|
||||
|
|
Loading…
Reference in New Issue