Skip to content

Commit

Permalink
added big-endian support
Browse files Browse the repository at this point in the history
  • Loading branch information
brouhaha committed Aug 18, 2003
1 parent 9f01e74 commit cdc73fc
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bitblt_table_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* tumble: build a PDF file from image files
*
* bitblt table generator
* $Id: bitblt_table_gen.c,v 1.7 2003/03/13 00:57:05 eric Exp $
* $Id: bitblt_table_gen.c,v 1.8 2003/08/18 01:59:41 eric Exp $
* Copyright 2003 Eric Smith <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -71,6 +71,16 @@ int count_run (int byte, int start_bit, int desired_val)
int count = 0;
int i;

#ifdef WORDS_BIGENDIAN
for (i = 7 - start_bit; i >= 0; i--)
{
int bit = (byte >> i) & 1;
if (bit == desired_val)
count++;
else
break;
}
#else
for (i = start_bit; i < 8; i++)
{
int bit = (byte >> i) & 1;
Expand All @@ -79,6 +89,8 @@ int count_run (int byte, int start_bit, int desired_val)
else
break;
}
#endif

return (count);
}

Expand Down

0 comments on commit cdc73fc

Please sign in to comment.