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

Method One

core/codegen/arithmetic.go:33–47  ·  view source on GitHub ↗

One returns a one-value of the specified bool, int or float type.

(ty Type)

Source from the content-addressed store, hash-verified

31
32// One returns a one-value of the specified bool, int or float type.
33func (b *Builder) One(ty Type) *Value {
34 var value *Value
35 switch {
36 case ty == b.m.Types.Bool:
37 value = b.val(ty, llvm.ConstInt(ty.llvmTy(), 1, false))
38 case IsInteger(ty):
39 value = b.val(ty, llvm.ConstInt(ty.llvmTy(), 1, false))
40 case IsFloat(ty):
41 value = b.val(ty, llvm.ConstFloat(ty.llvmTy(), 1))
42 default:
43 fail("One does not support type %T", ty)
44 }
45 value.SetName("1")
46 return value
47}
48
49// Not returns !x. The type of x must be Bool.
50func (b *Builder) Not(x *Value) *Value {

Callers 1

iterationMethod · 0.80

Calls 6

valMethod · 0.95
SetNameMethod · 0.95
IsFloatFunction · 0.85
IsIntegerFunction · 0.70
failFunction · 0.70
llvmTyMethod · 0.65

Tested by

no test coverage detected