MCPcopy Create free account
hub / github.com/DNAProject/DNA / compareFuncIntValue

Function compareFuncIntValue

vm/neovm/int_value_test.go:124–161  ·  view source on GitHub ↗
(left, right *big.Int, opcode OpCode)

Source from the content-addressed store, hash-verified

122}
123
124func compareFuncIntValue(left, right *big.Int, opcode OpCode) ([]byte, error) {
125 lhs, err := types.IntValFromBigInt(left)
126 if err != nil {
127 return nil, err
128 }
129 rhs, err := types.IntValFromBigInt(right)
130 if err != nil {
131 return nil, err
132 }
133 var val types.IntValue
134 switch opcode {
135 case AND:
136 val, err = lhs.And(rhs)
137 case OR:
138 val, err = lhs.Or(rhs)
139 case XOR:
140 val, err = lhs.Xor(rhs)
141 case ADD:
142 val, err = lhs.Add(rhs)
143 case SUB:
144 val, err = lhs.Sub(rhs)
145 case MUL:
146 val, err = lhs.Mul(rhs)
147 case DIV:
148 val, err = lhs.Div(rhs)
149 case MOD:
150 val, err = lhs.Mod(rhs)
151 case SHL:
152 val, err = lhs.Lsh(rhs)
153 case SHR:
154 val, err = lhs.Rsh(rhs)
155 case MIN:
156 val, err = lhs.Min(rhs)
157 case MAX:
158 val, err = lhs.Max(rhs)
159 }
160 return val.ToNeoBytes(), err
161}
162
163func compareFuncBigInt(left, right *big.Int, opcode OpCode) ([]byte, error) {
164 if opcode == SHL {

Callers 1

TestIntValue_OtherFunction · 0.85

Calls 14

ToNeoBytesMethod · 0.95
IntValFromBigIntFunction · 0.92
AndMethod · 0.80
OrMethod · 0.80
XorMethod · 0.80
AddMethod · 0.80
SubMethod · 0.80
MulMethod · 0.80
DivMethod · 0.80
ModMethod · 0.80
LshMethod · 0.80
RshMethod · 0.80

Tested by

no test coverage detected