Skip to content

Commit 1d698ba

Browse files
committedDec 7, 2019
Do not use unsafe to take address of slice element
1 parent c6266f4 commit 1d698ba

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎alloc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (al *allocator) LNumber2I(v LNumber) LValue {
6868

6969
// alloc a new float, and store our value into it
7070
al.fptrs = append(al.fptrs, float64(v))
71-
fptr := (*float64)(unsafe.Pointer(al.fheader.Data + uintptr(len(al.fptrs)-1)*unsafe.Sizeof(_fv)))
71+
fptr := &al.fptrs[len(al.fptrs)-1]
7272

7373
// hack our scratch LValue to point to our allocated value
7474
// this scratch lvalue is copied when this function returns meaning the scratch value can be reused

0 commit comments

Comments
 (0)