You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
I'm curious: Why does image.NRGBA64 define Pix as a []uint8 and perpetually pack pairs of uint8 values into a uint16? Wouldn't it have been easier and faster to define Pix as a []uint16 and Stride to be a stride in uint16s rather than uint8s?
— Scott
Nigel Tao
unread,
Sep 28, 2021, 7:02:48 PM9/28/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Scott Pakin, golang-nuts
On Tue, Sep 28, 2021 at 3:53 AM Scott Pakin <scot...@pakin.org> wrote:
I'm curious: Why does image.NRGBA64 define Pix as a []uint8 and perpetually pack pairs of uint8 values into a uint16? Wouldn't it have been easier and faster to define Pix as a []uint16 and Stride to be a stride in uint16s rather than uint8s?
It would have been easier for some things, but it would make it harder to work with the encoders and decoders. The compress/* and io packages work with []uint8, not []uint16.
There didn't seem to be perfect solution, only trade-offs.
Scott Pakin
unread,
Sep 28, 2021, 10:46:14 PM9/28/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
Thanks for the response. It strikes me that the primitive NRGBA operations (get pixel, set pixel, and the like) would occur far more common in practice than encoders, decoders, compress/*, and io, but maybe that's just how I tend to use images.