MCPcopy Create free account
hub / github.com/google/gapid / Equal

Method Equal

core/codegen/arithmetic.go:96–112  ·  view source on GitHub ↗

Equal returns x == y. The types of the two values must be equal.

(x, y *Value)

Source from the content-addressed store, hash-verified

94
95// Equal returns x == y. The types of the two values must be equal.
96func (b *Builder) Equal(x, y *Value) *Value {
97 ty := x.Type()
98 if ty, ok := ty.(*Struct); ok {
99 assertTypesEqual(x.Type(), y.Type())
100 var eq *Value
101 for i, f := range ty.Fields() {
102 x, y := x.Extract(f.Name), y.Extract(f.Name)
103 if i == 0 {
104 eq = b.Equal(x, y)
105 } else {
106 eq = b.And(eq, b.Equal(x, y))
107 }
108 }
109 return eq
110 }
111 return b.cmp(x, "==", y, llvm.IntEQ, llvm.IntEQ, llvm.FloatOEQ)
112}
113
114// NotEqual returns x != y. The types of the two values must be equal.
115func (b *Builder) NotEqual(x, y *Value) *Value {

Callers 15

SameAsMethod · 0.45
compareProtosFunction · 0.45
convMethod · 0.45
checkMethod · 0.45
FormatMethod · 0.45
IsMethod · 0.45
IsMethod · 0.45
IterateMapMethod · 0.45
doBinaryOpMethod · 0.45
buildMethod · 0.45
buildRefRelsMethod · 0.45
loadRemapMethod · 0.45

Calls 6

AndMethod · 0.95
cmpMethod · 0.95
assertTypesEqualFunction · 0.85
FieldsMethod · 0.80
ExtractMethod · 0.80
TypeMethod · 0.65

Tested by 4

TestWriteOn32bitArchFunction · 0.36
TestWriteOn64bitArchFunction · 0.36