c - Is it safe to read and write on an array of 32 bit data byte by byte? -
so have void * data of 32 bit unsigned integers represents pixels. okay me access 1 of pixels char * , modify values directly? or better store new pixel in temporary uint32_t variable , assign correct pointer dereferencing or @ least memcpy?
will have problems memory alignment or possibly performance depending on hardware platform?
yes, correct. danger generating bit pattern not correspond int, on modern systems there no such patterns. also, if data type uint32_t specifically, prohibited having such patterns anyway.
note inverse situation of using uint32_t write multiple chars @ once not permitted (strict aliasing rule).
Comments
Post a Comment