@@ -11,9 +11,9 @@ that can be found in the LICENSE file.
11
11
This file contains string interpolation V functions
12
12
=============================================================================*/
13
13
14
- // = ============================================================================
15
- // Enum format types max 0x1F => 32 types
16
- // =============================================================================
14
+ /* ============================================================================
15
+ Enum format types max 0x1F => 32 types
16
+ =============================================================================*/
17
17
pub enum StrIntpType {
18
18
si_no_str = 0 // no parameter to print only fix string
19
19
si_c
@@ -60,9 +60,7 @@ pub fn (x StrIntpType) str() string {
60
60
}
61
61
}
62
62
63
- // =============================================================================
64
- // Union data
65
- // =============================================================================
63
+ // Union data used by StrIntpData
66
64
pub union StrIntpMem {
67
65
pub mut :
68
66
d_c u32
@@ -96,10 +94,7 @@ fn abs64(x i64) u64 {
96
94
return if x < 0 { u64 (- x) } else { u64 (x) }
97
95
}
98
96
99
- // =========================================
100
- //
101
97
// u32/u64 bit compact format
102
- //
103
98
// ___ 32 24 16 8
104
99
// ___ | | | |
105
100
// _3333333333222222222211111111110000000000
@@ -116,7 +111,7 @@ fn abs64(x i64) u64 {
116
111
// P pad char 1/8 bit padding char (in u32 format reduced to 1 bit as flag for `0` padding)
117
112
// --------------
118
113
// TOTAL: 39/32 bit
119
- // =========================================
114
+ // ---------------------------------------
120
115
121
116
// convert from data format to compact u64
122
117
pub fn get_str_intp_u64_format (fmt_type StrIntpType, in_width int , in_precision int , in_tail_zeros bool , in_sign bool , in_pad_ch byte , in_base int , in_upper_case bool ) u64 {
@@ -639,7 +634,7 @@ fn (data &StrIntpData) process_str_intp_data(mut sb strings.Builder) {
639
634
}
640
635
}
641
636
642
- // ====================================================================================
637
+ // --------------------------------------------------
643
638
644
639
// storing struct used by cgen
645
640
pub struct StrIntpCgenData {
@@ -680,15 +675,11 @@ pub fn str_intp(data_len int, in_data voidptr) string {
680
675
return ret
681
676
}
682
677
683
- // ====================================================================================
684
- // Utility for the compiler "auto_str_methods.v"
685
- // ====================================================================================
686
-
687
- // substitute old _STR calls
688
-
678
+ // The consts here are utilities for the compiler's "auto_str_methods.v".
679
+ // They are used to substitute old _STR calls.
680
+ // FIXME: this const is not released from memory => use a precalculated string const for now.
681
+ // si_s_code = "0x" + int(StrIntpType.si_s).hex() // code for a simple string.
689
682
pub const (
690
- // BUG: this const is not released from the memory! use a const for now
691
- // si_s_code = "0x" + int(StrIntpType.si_s).hex() // code for a simple string
692
683
si_s_code = '0xfe10'
693
684
si_g32_code = '0xfe0e'
694
685
si_g64_code = '0xfe0f'
0 commit comments