Skip to content

Commit ae0f28d

Browse files
committed
fix compile error
1 parent c43f216 commit ae0f28d

File tree

4 files changed

+28
-13
lines changed

4 files changed

+28
-13
lines changed

encode.v

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ pub fn (mut e Encoder) encode_bool(b bool) {
123123
pub fn (mut e Encoder) encode_int(i i64) {
124124
if e.config.positive_int_unsigned && i >= 0 {
125125
e.encode_uint(u64(i))
126-
} else if i > math.max_i8 {
127-
if i <= math.max_i16 {
126+
} else if i > max_i8 {
127+
if i <= max_i16 {
128128
e.encode_i16(i16(i))
129-
} else if i <= math.max_i32 {
129+
} else if i <= max_i32 {
130130
e.encode_i32(int(i))
131131
} else {
132132
e.encode_i64(i)
@@ -137,11 +137,11 @@ pub fn (mut e Encoder) encode_int(i i64) {
137137
} else {
138138
e.write_u8(u8(i))
139139
}
140-
} else if i >= math.min_i8 {
140+
} else if i >= min_i8 {
141141
e.encode_i8(i8(i))
142-
} else if i >= math.min_i16 {
142+
} else if i >= min_i16 {
143143
e.encode_i16(i16(i))
144-
} else if i >= math.min_i32 {
144+
} else if i >= min_i32 {
145145
e.encode_i32(int(i))
146146
} else {
147147
e.encode_i64(i)
@@ -150,17 +150,17 @@ pub fn (mut e Encoder) encode_int(i i64) {
150150

151151
// encode using type just big enough to fit `i`
152152
pub fn (mut e Encoder) encode_uint(i u64) {
153-
if i <= math.max_i8 {
153+
if i <= max_i8 {
154154
if e.config.no_fixed_num {
155155
e.encode_u8(u8(i))
156156
} else {
157157
e.write_u8(u8(i))
158158
}
159-
} else if i <= math.max_u8 {
159+
} else if i <= max_u8 {
160160
e.encode_u8(u8(i))
161-
} else if i <= math.max_u16 {
161+
} else if i <= max_u16 {
162162
e.encode_u16(u16(i))
163-
} else if i <= math.max_u32 {
163+
} else if i <= max_u32 {
164164
e.encode_u32(u32(i))
165165
} else {
166166
e.encode_u64(u64(i))
286 KB
Binary file not shown.

examples/bench_msgpack_json_vs_json2.v

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/*
2+
╰─ v doctor ─╯
3+
V full version: V 0.4.4 ed5c2f3.d5370bd
4+
OS: linux, Ubuntu 23.10
5+
Processor: 16 cpus, 64bit, little endian, AMD Ryzen 7 5800H with Radeon Graphics
6+
7+
╰─ v -prod crun examples/bench_msgpack_json_vs_json2.v ─╯
8+
SPENT 748.000 ms in json2.decode
9+
SPENT 178.232 ms in json.decode
10+
11+
SPENT 300.852 ms in json2.encode
12+
SPENT 433.072 ms in json.encode
13+
14+
SPENT 557.618 ms in msgpack.encode_to_json
15+
SPENT 129.682 ms in msgpack.encode
16+
*/
17+
118
module main
219

320
import os

types.v

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
module msgpack
22

3-
import math
4-
53
// Spec: https://github.com/msgpack/msgpack/blob/master/spec.md
64
// 7-bit positive integer
75
const mp_pos_fix_int_min = u8(0x00)
@@ -97,7 +95,7 @@ const mp_time_ext_type = u8(-1)
9795
// container_len_unknown = -1
9896
// container_len_nil is length returned from read_(map|array)_len
9997
// when a 'nil' was encountered in the stream.
100-
const container_len_nil = math.min_i32
98+
const container_len_nil = min_i32
10199

102100
struct RawExt {
103101
tag u64

0 commit comments

Comments
 (0)