Skip to content

Commit

Permalink
Merge pull request #48 from leonnicolas/32bit_support
Browse files Browse the repository at this point in the history
Add support for 32 bit architecture
  • Loading branch information
goccy authored Aug 31, 2021
2 parents be6138b + 2fe7bc6 commit b9dc53b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/ccall/cdt.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ import (
"unsafe"
)

const wordSize = 4 << (^uintptr(0) >> 63)

type Dtlink struct {
c *C.Dtlink_t
}
Expand Down Expand Up @@ -125,7 +127,7 @@ func (g *Dtlink) Left() *Dtlink {
}

func (g *Dtlink) SetLeft(v *Dtlink) {
g.c.hl = *(*[8]byte)(unsafe.Pointer(v.c))
g.c.hl = *(*[wordSize]byte)(unsafe.Pointer(v.c))
}

func ToDthold(c *C.Dthold_t) *Dthold {
Expand Down Expand Up @@ -235,7 +237,7 @@ func (g *Dtdata) Htab() []*Dtlink {

func (g *Dtdata) SetHtab(v []*Dtlink) {
header := (*reflect.SliceHeader)(unsafe.Pointer(&v))
g.c.hh = *(*[8]byte)(unsafe.Pointer(header.Data))
g.c.hh = *(*[wordSize]byte)(unsafe.Pointer(header.Data))
}

func (g *Dtdata) Head() *Dtlink {
Expand All @@ -244,7 +246,7 @@ func (g *Dtdata) Head() *Dtlink {
}

func (g *Dtdata) SetHead(v *Dtlink) {
g.c.hh = *(*[8]byte)(unsafe.Pointer(v.c))
g.c.hh = *(*[wordSize]byte)(unsafe.Pointer(v.c))
}

func (g *Dtdata) Ntab() int {
Expand Down

0 comments on commit b9dc53b

Please sign in to comment.