you could do your unsafe cast to an appropriately-sized byte array and write that as a single call or use it to access the bytes:
base := *(*[8]byte)(unsafe.Pointer(&doubleThing)) bs[offset+0]=base[0] bs[offset+1]=base[1] : offset+=8 On Fri, Oct 27, 2017 at 10:18 PM, Tamás Gulácsi <tgulacs...@gmail.com> wrote: > Wouldn't math.Float64bits be easier? And > encoding/binary.LittleEndian.PutUint64 > would help the readability, too. > > If you need more speed, and the records have the same structure, you could > do the type swith once: create a slice of type-specific functions, and > later just invoke them. > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Michael T. Jones michael.jo...@gmail.com -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.