Optimized and correct handling of 16 bit in _get_8_bits()

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@27669 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Riccardo Mottola 2009-01-24 17:44:11 +00:00
parent 993a5d976b
commit d3974d45dc
2 changed files with 16 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2009-01-13 Riccardo Mottola <rmottola@users.sf.net>
* Source/art/image.m: Optimized and correct handling of 16 bit in _get_8_bits()
2009-01-17 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/x11/XGServerWindow.m (_setSupportedWMProtocols:,

View file

@ -52,6 +52,18 @@ not just discard the extra bits
bit_ofs %= 8;
v = 0;
/* if we are handling 16 bit values we optimize */
/* TODO: this code could be little/big-endian unsafe */
if (num_bits == 16)
{
ptr++;
v = *ptr;
return v;
}
for (i = 0; i < 8 && i < num_bits; i++)
{
v <<= 1;