Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Image::SetPixel, is the last one post-increment really needed?  (Read 2390 times)

0 Members and 1 Guest are viewing this topic.

grok

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
    • Email
Image::SetPixel, is the last one post-increment really needed?
« on: January 27, 2015, 01:21:10 pm »
Hi.
Out of curiosity,  is the last post-increment really needed in the code below?
void Image::setPixel(unsigned int x, unsigned int y, const Color& color)
{
Uint8* pixel = &m_pixels[(x + y * m_size.x) * 4];
*pixel++ = color.r;
*pixel++ = color.g;
*pixel++ = color.b;
*pixel++ = color.a; //this one
}
 

Please don't throw rocks at me, I know it has almost nothing to do with the optimization, but anyway...

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Image::SetPixel, is the last one post-increment really needed?
« Reply #1 on: January 27, 2015, 02:57:33 pm »
No, it is not needed.
Laurent Gomila - SFML developer