no thank you, no very nasty union tricks here

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2237 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Daniel Stenberg 2002-09-09 13:13:17 +00:00
parent 7c57db5560
commit 89db47fde8
2 changed files with 4 additions and 14 deletions

View file

@ -799,9 +799,7 @@ void test_print(unsigned char c, BDF* font, short* enc_map)
{
unsigned short bmp = 0;
unsigned short sh;
DOUBLE_BYTE db;
db.db[0] = g->bitmap[i*2];
db.db[1] = g->bitmap[i*2+1];
int db= (g->bitmap[i*2] | (g->bitmap[i*2+1] <<8));
sh = 1 << 7; /*g->dwidth_x;*/
@ -814,7 +812,7 @@ void test_print(unsigned char c, BDF* font, short* enc_map)
sh = 1 << (sizeof(unsigned short)*8-1);
bit = sh>>(j - 8);
}
b = bit & db.sval;
b = bit & db;
printf( b ? "*" : " " );
}
@ -884,9 +882,7 @@ void getBitmap(BDF_GLYPH* g, unsigned char* src)
{
unsigned short bmp = 0;
unsigned short sh, srcmap;
DOUBLE_BYTE db;
db.db[0] = g->bitmap[i*2];
db.db[1] = g->bitmap[i*2+1];
int db= (g->bitmap[i*2] | (g->bitmap[i*2+1] <<8));
sh = 1 << 7; /*g->dwidth_x;*/
@ -906,7 +902,7 @@ void getBitmap(BDF_GLYPH* g, unsigned char* src)
sh = 1 << (sizeof(unsigned short)*8-1);
bit = sh>>(j - 8);
}
b = bit&db.sval;
b = bit&db;
if (b)
src[j*rows+d] |= srcmap;

View file

@ -60,12 +60,6 @@ typedef struct
BDF_GLYPH* enc_table[256];
} BDF;
typedef union
{
unsigned char db[2];
unsigned short sval;
} DOUBLE_BYTE;
BDF* readFont(const char *name);
BDF_GLYPH* getGlyph(unsigned char c, BDF* bdf, short* enc_map);
void getBitmap(BDF_GLYPH* g, unsigned char* src);