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

Method Sub

core/codegen/arithmetic.go:173–184  ·  view source on GitHub ↗

Sub returns x - y. The types of the two values must be equal.

(x, y *Value)

Source from the content-addressed store, hash-verified

171
172// Sub returns x - y. The types of the two values must be equal.
173func (b *Builder) Sub(x, y *Value) *Value {
174 assertTypesEqual(x.Type(), y.Type())
175 ty := Scalar(x.Type())
176 switch {
177 case IsInteger(ty):
178 return b.val(x.Type(), b.llvm.CreateSub(x.llvm, y.llvm, x.Name()+"-"+y.Name()))
179 case IsFloat(ty):
180 return b.val(x.Type(), b.llvm.CreateFSub(x.llvm, y.llvm, x.Name()+"-"+y.Name()))
181 default:
182 panic(fmt.Errorf("Cannot subtract values of type %v", ty))
183 }
184}
185
186// SubS returns x - y. The types of the two values must be equal.
187func (b *Builder) SubS(x *Value, y interface{}) *Value {

Callers 6

SubSMethod · 0.95
RunMethod · 0.45
recordFrameStatisticsFunction · 0.45
recordTouchInfoFunction · 0.45
startRecordingInputsFunction · 0.45
startReplayingInputsFunction · 0.45

Calls 7

valMethod · 0.95
assertTypesEqualFunction · 0.85
ScalarFunction · 0.85
IsFloatFunction · 0.85
IsIntegerFunction · 0.70
TypeMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected