@@ -94,31 +94,31 @@ func NewUint64Number(u uint64) Number {
94
94
// - as x
95
95
96
96
// AsNumber gets the Number.
97
- func (n Number ) AsNumber () Number {
98
- return n
97
+ func (n * Number ) AsNumber () Number {
98
+ return * n
99
99
}
100
100
101
101
// AsRaw gets the uninterpreted raw value. Might be useful for some
102
102
// atomic operations.
103
- func (n Number ) AsRaw () uint64 {
104
- return uint64 (n )
103
+ func (n * Number ) AsRaw () uint64 {
104
+ return uint64 (* n )
105
105
}
106
106
107
107
// AsInt64 assumes that the value contains an int64 and returns it as
108
108
// such.
109
- func (n Number ) AsInt64 () int64 {
109
+ func (n * Number ) AsInt64 () int64 {
110
110
return rawToInt64 (n .AsRaw ())
111
111
}
112
112
113
113
// AsFloat64 assumes that the measurement value contains a float64 and
114
114
// returns it as such.
115
- func (n Number ) AsFloat64 () float64 {
115
+ func (n * Number ) AsFloat64 () float64 {
116
116
return rawToFloat64 (n .AsRaw ())
117
117
}
118
118
119
119
// AsUint64 assumes that the value contains an uint64 and returns it
120
120
// as such.
121
- func (n Number ) AsUint64 () uint64 {
121
+ func (n * Number ) AsUint64 () uint64 {
122
122
return rawToUint64 (n .AsRaw ())
123
123
}
124
124
@@ -183,7 +183,7 @@ func (n *Number) AsUint64Ptr() *uint64 {
183
183
184
184
// CoerceToInt64 casts the number to int64. May result in
185
185
// data/precision loss.
186
- func (n Number ) CoerceToInt64 (kind NumberKind ) int64 {
186
+ func (n * Number ) CoerceToInt64 (kind NumberKind ) int64 {
187
187
switch kind {
188
188
case Int64NumberKind :
189
189
return n .AsInt64 ()
@@ -199,7 +199,7 @@ func (n Number) CoerceToInt64(kind NumberKind) int64 {
199
199
200
200
// CoerceToFloat64 casts the number to float64. May result in
201
201
// data/precision loss.
202
- func (n Number ) CoerceToFloat64 (kind NumberKind ) float64 {
202
+ func (n * Number ) CoerceToFloat64 (kind NumberKind ) float64 {
203
203
switch kind {
204
204
case Int64NumberKind :
205
205
return float64 (n .AsInt64 ())
@@ -215,7 +215,7 @@ func (n Number) CoerceToFloat64(kind NumberKind) float64 {
215
215
216
216
// CoerceToUint64 casts the number to uint64. May result in
217
217
// data/precision loss.
218
- func (n Number ) CoerceToUint64 (kind NumberKind ) uint64 {
218
+ func (n * Number ) CoerceToUint64 (kind NumberKind ) uint64 {
219
219
switch kind {
220
220
case Int64NumberKind :
221
221
return uint64 (n .AsInt64 ())
@@ -498,7 +498,7 @@ func (n *Number) CompareAndSwapUint64(ou, nu uint64) bool {
498
498
// 0 if the numbers are equal
499
499
// -1 if the subject `n` is less than the argument `nn`
500
500
// +1 if the subject `n` is greater than the argument `nn`
501
- func (n Number ) CompareNumber (kind NumberKind , nn Number ) int {
501
+ func (n * Number ) CompareNumber (kind NumberKind , nn Number ) int {
502
502
switch kind {
503
503
case Int64NumberKind :
504
504
return n .CompareInt64 (nn .AsInt64 ())
@@ -514,7 +514,7 @@ func (n Number) CompareNumber(kind NumberKind, nn Number) int {
514
514
515
515
// CompareRaw compares two numbers, where one is input as a raw
516
516
// uint64, interpreting both values as a `kind` of number.
517
- func (n Number ) CompareRaw (kind NumberKind , r uint64 ) int {
517
+ func (n * Number ) CompareRaw (kind NumberKind , r uint64 ) int {
518
518
return n .CompareNumber (kind , NewNumberFromRaw (r ))
519
519
}
520
520
@@ -523,7 +523,7 @@ func (n Number) CompareRaw(kind NumberKind, r uint64) int {
523
523
// typical result of the compare function: -1 if the value is less
524
524
// than the other, 0 if both are equal, 1 if the value is greater than
525
525
// the other.
526
- func (n Number ) CompareInt64 (i int64 ) int {
526
+ func (n * Number ) CompareInt64 (i int64 ) int {
527
527
this := n .AsInt64 ()
528
528
if this < i {
529
529
return - 1
@@ -540,7 +540,7 @@ func (n Number) CompareInt64(i int64) int {
540
540
// greater than the other.
541
541
//
542
542
// Do not compare NaN values.
543
- func (n Number ) CompareFloat64 (f float64 ) int {
543
+ func (n * Number ) CompareFloat64 (f float64 ) int {
544
544
this := n .AsFloat64 ()
545
545
if this < f {
546
546
return - 1
@@ -555,7 +555,7 @@ func (n Number) CompareFloat64(f float64) int {
555
555
// typical result of the compare function: -1 if the value is less
556
556
// than the other, 0 if both are equal, 1 if the value is greater than
557
557
// the other.
558
- func (n Number ) CompareUint64 (u uint64 ) int {
558
+ func (n * Number ) CompareUint64 (u uint64 ) int {
559
559
this := n .AsUint64 ()
560
560
if this < u {
561
561
return - 1
@@ -568,17 +568,17 @@ func (n Number) CompareUint64(u uint64) int {
568
568
// - relations to zero
569
569
570
570
// IsPositive returns true if the actual value is greater than zero.
571
- func (n Number ) IsPositive (kind NumberKind ) bool {
571
+ func (n * Number ) IsPositive (kind NumberKind ) bool {
572
572
return n .compareWithZero (kind ) > 0
573
573
}
574
574
575
575
// IsNegative returns true if the actual value is less than zero.
576
- func (n Number ) IsNegative (kind NumberKind ) bool {
576
+ func (n * Number ) IsNegative (kind NumberKind ) bool {
577
577
return n .compareWithZero (kind ) < 0
578
578
}
579
579
580
580
// IsZero returns true if the actual value is equal to zero.
581
- func (n Number ) IsZero (kind NumberKind ) bool {
581
+ func (n * Number ) IsZero (kind NumberKind ) bool {
582
582
return n .compareWithZero (kind ) == 0
583
583
}
584
584
@@ -587,7 +587,7 @@ func (n Number) IsZero(kind NumberKind) bool {
587
587
// Emit returns a string representation of the raw value of the
588
588
// Number. A %d is used for integral values, %f for floating point
589
589
// values.
590
- func (n Number ) Emit (kind NumberKind ) string {
590
+ func (n * Number ) Emit (kind NumberKind ) string {
591
591
switch kind {
592
592
case Int64NumberKind :
593
593
return fmt .Sprintf ("%d" , n .AsInt64 ())
@@ -602,7 +602,7 @@ func (n Number) Emit(kind NumberKind) string {
602
602
603
603
// AsInterface returns the number as an interface{}, typically used
604
604
// for NumberKind-correct JSON conversion.
605
- func (n Number ) AsInterface (kind NumberKind ) interface {} {
605
+ func (n * Number ) AsInterface (kind NumberKind ) interface {} {
606
606
switch kind {
607
607
case Int64NumberKind :
608
608
return n .AsInt64 ()
@@ -617,7 +617,7 @@ func (n Number) AsInterface(kind NumberKind) interface{} {
617
617
618
618
// - private stuff
619
619
620
- func (n Number ) compareWithZero (kind NumberKind ) int {
620
+ func (n * Number ) compareWithZero (kind NumberKind ) int {
621
621
switch kind {
622
622
case Int64NumberKind :
623
623
return n .CompareInt64 (0 )
0 commit comments