2020-05-18 15:57:22 +00:00
|
|
|
/*
|
|
|
|
Package util contains some special useful functions that are provided by compiler and VM.
|
|
|
|
*/
|
2018-08-20 08:59:35 +00:00
|
|
|
package util
|
|
|
|
|
2021-10-22 11:50:51 +00:00
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/interop/neogointernal"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Abort terminates current execution, unlike exception throwing with panic() it
|
|
|
|
// can't be recovered from.
|
|
|
|
func Abort() {
|
2021-10-23 13:12:42 +00:00
|
|
|
neogointernal.Opcode0NoReturn("ABORT")
|
2021-10-22 11:50:51 +00:00
|
|
|
}
|
2020-08-28 07:47:15 +00:00
|
|
|
|
2020-05-18 15:57:22 +00:00
|
|
|
// Equals compares a with b and will return true when a and b are equal. It's
|
|
|
|
// implemented as an EQUAL VM opcode, so the rules of comparison are those
|
|
|
|
// of EQUAL.
|
2023-04-03 10:34:24 +00:00
|
|
|
func Equals(a, b any) bool {
|
2021-10-23 13:12:42 +00:00
|
|
|
return neogointernal.Opcode2("EQUAL", a, b).(bool)
|
2018-08-23 08:17:42 +00:00
|
|
|
}
|
2020-09-15 07:05:41 +00:00
|
|
|
|
|
|
|
// Remove removes element with index i from slice.
|
|
|
|
// This is done in place and slice must have type other than `[]byte`.
|
2023-04-03 10:34:24 +00:00
|
|
|
func Remove(slice any, i int) {
|
2021-10-23 13:12:42 +00:00
|
|
|
neogointernal.Opcode2NoReturn("REMOVE", slice, i)
|
2020-09-15 07:05:41 +00:00
|
|
|
}
|