- 1
- 2
- 3
- 4
void setPixel24(int row, int col, Uint32 pixel) noexcept
{
*reinterpret_cast<Uint32*>(static_cast<Uint8*>(handle->pixels) + row * handle->pitch + 3 * col * sizeof(Uint8)) = pixel;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−14
void setPixel24(int row, int col, Uint32 pixel) noexcept
{
*reinterpret_cast<Uint32*>(static_cast<Uint8*>(handle->pixels) + row * handle->pitch + 3 * col * sizeof(Uint8)) = pixel;
}
http://stackoverflow.com/questions/2215445/are-there-machines-where-sizeofchar-1-or-at-least-char-bit-8
http://stackoverflow.com/questions/881894/is-char-guaranteed-to-be-exactly-8-bit-long
в С++17 выпилили триграфы даже
теперь на машинах 70-х годов на С++ не попишешь