return duintxx(s, off, v, Widthptr)
}
+func dbvec(s *Sym, off int, bv bvec) int {
+ for j := 0; int32(j) < bv.n; j += 32 {
+ 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))
+ }
+ return off
+}
+
// stringConstantSyms holds the pair of symbols we create for a
// constant string.
type stringConstantSyms struct {
onebitwalktype1(Curfn.Type.Params(), &xoffset, bv)
}
- for j := 0; int32(j) < bv.n; j += 32 {
- off = duint32(sym, off, bv.b[j/32])
- }
+ off = dbvec(sym, off, bv)
if Curfn.Type.Results().NumFields() > 0 {
xoffset = 0
onebitwalktype1(Curfn.Type.Results(), &xoffset, bv)
- for j := 0; int32(j) < bv.n; j += 32 {
- off = duint32(sym, off, bv.b[j/32])
- }
+ off = dbvec(sym, off, bv)
}
ggloblsym(sym, int32(off), obj.RODATA|obj.LOCAL)
// Dumps a slice of bitmaps to a symbol as a sequence of uint32 values. The
// first word dumped is the total number of bitmaps. The second word is the
// length of the bitmaps. All bitmaps are assumed to be of equal length. The
-// words that are followed are the raw bitmap words.
+// remaining bytes are the raw bitmaps.
func onebitwritesymbol(arr []bvec, sym *Sym) {
off := 4 // number of bitmaps, to fill in later
off = duint32(sym, off, uint32(arr[0].n)) // number of bits in each bitmap
if bv.b == nil {
break
}
- for j := 0; int32(j) < bv.n; j += 32 {
- word := bv.b[j/32]
-
- // Runtime reads the bitmaps as byte arrays. Oblige.
- off = duint8(sym, off, uint8(word))
-
- off = duint8(sym, off, uint8(word>>8))
- off = duint8(sym, off, uint8(word>>16))
- off = duint8(sym, off, uint8(word>>24))
- }
+ off = dbvec(sym, off, bv)
}
duint32(sym, 0, uint32(i)) // number of bitmaps