| 1 | module strconv |
| 2 | |
| 3 | // The structure is filled by parser, then given to converter. |
| 4 | pub struct PrepNumber { |
| 5 | pub mut: |
| 6 | negative bool // 0 if positive number, 1 if negative |
| 7 | exponent int // power of 10 exponent |
| 8 | mantissa u64 // integer mantissa |
| 9 | } |
| 10 | |
| 11 | // dec32 is a floating decimal type representing m * 10^e. |
| 12 | struct Dec32 { |
| 13 | mut: |
| 14 | m u32 |
| 15 | e int |
| 16 | } |
| 17 | |
| 18 | // dec64 is a floating decimal type representing m * 10^e. |
| 19 | struct Dec64 { |
| 20 | mut: |
| 21 | m u64 |
| 22 | e int |
| 23 | } |
| 24 | |
| 25 | struct Uint128 { |
| 26 | mut: |
| 27 | lo u64 |
| 28 | hi u64 |
| 29 | } |
| 30 | |
| 31 | // support union for convert f32 to u32 |
| 32 | union Uf32 { |
| 33 | mut: |
| 34 | f f32 |
| 35 | u u32 |
| 36 | } |
| 37 | |
| 38 | // support union for convert f64 to u64 |
| 39 | union Uf64 { |
| 40 | mut: |
| 41 | f f64 |
| 42 | u u64 |
| 43 | } |
| 44 | |
| 45 | pub union Float64u { |
| 46 | pub mut: |
| 47 | f f64 |
| 48 | u u64 |
| 49 | } |
| 50 | |
| 51 | pub union Float32u { |
| 52 | pub mut: |
| 53 | f f32 |
| 54 | u u32 |
| 55 | } |
| 56 | |