aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/json-iterator/go/any_float.go
diff options
context:
space:
mode:
authorLibravatar Rutger Broekhoff2023-12-29 21:31:53 +0100
committerLibravatar Rutger Broekhoff2023-12-29 21:31:53 +0100
commit404aeae4545d2426c089a5f8d5e82dae56f5212b (patch)
tree2d84e00af272b39fc04f3795ae06bc48970e57b5 /vendor/github.com/json-iterator/go/any_float.go
parent209d8b0187ed025dec9ac149ebcced3462877bff (diff)
downloadgitolfs3-404aeae4545d2426c089a5f8d5e82dae56f5212b.tar.gz
gitolfs3-404aeae4545d2426c089a5f8d5e82dae56f5212b.zip
Make Nix builds work
Diffstat (limited to 'vendor/github.com/json-iterator/go/any_float.go')
-rw-r--r--vendor/github.com/json-iterator/go/any_float.go83
1 files changed, 83 insertions, 0 deletions
diff --git a/vendor/github.com/json-iterator/go/any_float.go b/vendor/github.com/json-iterator/go/any_float.go
new file mode 100644
index 0000000..35fdb09
--- /dev/null
+++ b/vendor/github.com/json-iterator/go/any_float.go
@@ -0,0 +1,83 @@
1package jsoniter
2
3import (
4 "strconv"
5)
6
7type floatAny struct {
8 baseAny
9 val float64
10}
11
12func (any *floatAny) Parse() *Iterator {
13 return nil
14}
15
16func (any *floatAny) ValueType() ValueType {
17 return NumberValue
18}
19
20func (any *floatAny) MustBeValid() Any {
21 return any
22}
23
24func (any *floatAny) LastError() error {
25 return nil
26}
27
28func (any *floatAny) ToBool() bool {
29 return any.ToFloat64() != 0
30}
31
32func (any *floatAny) ToInt() int {
33 return int(any.val)
34}
35
36func (any *floatAny) ToInt32() int32 {
37 return int32(any.val)
38}
39
40func (any *floatAny) ToInt64() int64 {
41 return int64(any.val)
42}
43
44func (any *floatAny) ToUint() uint {
45 if any.val > 0 {
46 return uint(any.val)
47 }
48 return 0
49}
50
51func (any *floatAny) ToUint32() uint32 {
52 if any.val > 0 {
53 return uint32(any.val)
54 }
55 return 0
56}
57
58func (any *floatAny) ToUint64() uint64 {
59 if any.val > 0 {
60 return uint64(any.val)
61 }
62 return 0
63}
64
65func (any *floatAny) ToFloat32() float32 {
66 return float32(any.val)
67}
68
69func (any *floatAny) ToFloat64() float64 {
70 return any.val
71}
72
73func (any *floatAny) ToString() string {
74 return strconv.FormatFloat(any.val, 'E', -1, 64)
75}
76
77func (any *floatAny) WriteTo(stream *Stream) {
78 stream.WriteFloat64(any.val)
79}
80
81func (any *floatAny) GetInterface() interface{} {
82 return any.val
83}