-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfloat32.go
More file actions
31 lines (26 loc) · 731 Bytes
/
float32.go
File metadata and controls
31 lines (26 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package pointerhelpers
// Float32Helper contains all Float32 related
// pointer helpers
type Float32Helper struct {
}
// Float32 returns a pointer to the float32 value passed in.
func Float32(v float32) *float32 {
return &v
}
// Float32 returns a pointer to the float32 value passed in.
func (i *Float32Helper) Float32(v float32) *float32 {
return Float32(v)
}
// Float32Value returns the value of the float32 pointer passed in or
// 0 if the pointer is nil.
func Float32Value(v *float32) float32 {
if v != nil {
return *v
}
return 0
}
// Float32Value returns the value of the float32 pointer passed in or
// 0 if the pointer is nil.
func (i *Float32Helper) Float32Value(v *float32) float32 {
return Float32Value(v)
}