diff --git a/src/cmd/compile/internal/gc/obj.go b/src/cmd/compile/internal/gc/obj.go index 3610f16c747..cb9ea52b62c 100644 --- a/src/cmd/compile/internal/gc/obj.go +++ b/src/cmd/compile/internal/gc/obj.go @@ -272,14 +272,10 @@ func duintptr(s *Sym, off int, v uint64) int { } func dbvec(s *Sym, off int, bv bvec) int { - for j := 0; int32(j) < bv.n; j += 32 { + // Runtime reads the bitmaps as byte arrays. Oblige. + for j := 0; int32(j) < bv.n; j += 8 { word := bv.b[j/32] - - // Runtime reads the bitmaps as byte arrays. Oblige. - off = duint8(s, off, uint8(word)) - off = duint8(s, off, uint8(word>>8)) - off = duint8(s, off, uint8(word>>16)) - off = duint8(s, off, uint8(word>>24)) + off = duint8(s, off, uint8(word>>(uint(j)%32))) } return off } diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go index c1cca7037d7..24d63b70c00 100644 --- a/src/runtime/symtab.go +++ b/src/runtime/symtab.go @@ -603,5 +603,5 @@ func stackmapdata(stkmap *stackmap, n int32) bitvector { if n < 0 || n >= stkmap.n { throw("stackmapdata: index out of range") } - return bitvector{stkmap.nbit, (*byte)(add(unsafe.Pointer(&stkmap.bytedata), uintptr(n*((stkmap.nbit+31)/32*4))))} + return bitvector{stkmap.nbit, (*byte)(add(unsafe.Pointer(&stkmap.bytedata), uintptr(n*((stkmap.nbit+7)/8))))} }