473,902 Members | 3,411 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How many bits are '1' in a integer variable?

Hi folks,

I am trying to find a more efficient way to count "How many bits are
'1' in a integer variable?".

I still have no idea to count the bits except using a loop and "if"
statements.
Could you know any other more efficient way?

Cuthbert

int main (void)
{
int var = 0xFF0F;
int i, count = 0;
int mask = 1;
for ( i = 0; i < sizeof(int)*8 ; i++ )
if ( mask<<i & var) count++ ;

printf("%d\n", count);

return 0;
}

Sep 12 '06
34 11354

Cuthbert wrote:
Hi folks,

I am trying to find a more efficient way to count "How many bits are
'1' in a integer variable?".

I still have no idea to count the bits except using a loop and "if"
statements.
Could you know any other more efficient way?

Cuthbert

int main (void)
{
int var = 0xFF0F;
int i, count = 0;
int mask = 1;
for ( i = 0; i < sizeof(int)*8 ; i++ )
if ( mask<<i & var) count++ ;

printf("%d\n", count);

return 0;
}
There is a faster program easy to remember and i.e x&=(x-1) and doesn't
require any storage requirements. Here is the program

int main(void)
{
x = 0xFF0F;
int n = 0;

while(x)
{
x &= (x-1)
n++;
}

printf("No of bits = %d\n", n);
}

The worst case for the loop would be when all the bits are set.
Actually for each iteration the statement x=x&(x-1) would remove one
bit. Just check it out manually.

There is even better and faster algorithm but difficult to remember.

#define MASK_01010101 (((unsigned int)(-1))/3)
#define MASK_00110011 (((unsigned int)(-1))/5)
#define MASK_00001111 (((unsigned int)(-1))/17)

int bitcount (unsigned int n)
{
n = (n & MASK_01010101) + ((n >1) & MASK_01010101) ;
n = (n & MASK_00110011) + ((n >2) & MASK_00110011) ;
n = (n & MASK_00001111) + ((n >4) & MASK_00001111) ;
return n % 255 ;
}

I got this algorithm from my old book, hard to remember (atleast for me)

Sep 13 '06 #11
On 12 Sep 2006 13:48:55 -0700, "Ancient_Hacker " <gr**@comcast.n et>
wrote:
>
Cuthbert wrote:
>Hi folks,
a bit simpler and therefore perhaps somewhat faster:

int main (void)
{
int var = 0xFF0F;
int i, count = 0;

for ( i = 0; i < sizeof(int)*8 ; i++ )
{ count += var & 1; var >>= 1; }

printf("%d\n", count);

return 0;
}

a byte lookup table might or might not be faster, depending on what
happens with the cache.
On the TI 5501 DSP I'm currently working with, where sizeof(int) == 1
and CHAR_BIT == 16 (and the byte ordering is Big Endian, to boot), I'm
skeptical that this would work.

Use of a lookup table could easily result in exceeding the size of my
available EEPROM that stores my program memory (and that assumes that
you constructed the table with a priori knowledge that CHAR_BIT ==
16).

The least of my worries about this code may well be what happens with
the cache.

My PC-lint warnings make me even more twitchy about this code:

STD_FILE: std_5501.lnt
PC-lint for C/C++ (NT) Vers. 8.00u, Copyright Gimpel Software
1985-2006

--- Module: bits.c (C)
_
int var = 0xFF0F;
bits.c(3) : Warning 569: Loss of information (initialization ) (16 bits
to 15 bits)
_
for ( i = 0; i < sizeof(int)*8 ; i++ )
bits.c(6) : Warning 574: Signed-unsigned mix with relational
_
{ count += var & 1; var >>= 1; }
bits.c(7) : Info 702: Shift right of signed quantity (int)
_
printf("%d\n", count);
bits.c(9) : Info 718: Symbol 'printf' undeclared, assumed to return
int
bits.c(9) : Info 746: call to function 'printf()' not made in the
presence of a prototype

/// Start of Pass 2 ///

--- Module: bits.c (C)

--- Global Wrap-up

Note 900: Successful completion, 5 messages produced
Tool returned code: 0

Regards
--
jay
Sep 13 '06 #12
Cuthbert <cu**********@g mail.comwrote:
Hi folks,
I am trying to find a more efficient way to count "How many bits are
'1' in a integer variable?".
I still have no idea to count the bits except using a loop and "if"
statements.
Could you know any other more efficient way?
There are a couple.

E.g. when you take the 2's complement of a number, you do not complement
the lowest-order-bit. Using (-x)&x is therefore a way of "skiiping to
the next bit that's set" rather than having to go through bit positions
1 at a time -- 1/2 the time finding a 0.
Then there's the mysterious method that relies on carry in 2s complement
allowing you to "count" the 1's directly.
It's a recursive method (which you later can flatten out for particular
sizes of your compiuter's native word) based on the idea "how many bits
are set in a 2 bit quantity b1b2". To find out how many in this 2-bit
problem, you want to add b1 and b2. I.e. (x&1)+((x>>1)&1 ).
Now, what if we have (say) 4 bits b1b2b3b4? We can use
(x&5)+((x>>1)&5 ) to get [sum b1,b2][sum b3,b4] -- i.e. 2 x 2-bit quantities,
and then use
(x&3)+((x>>2)&3 ) to convert that to [sum b1,b2,b3,b4].
Just build up logically, as the old short story said. :)
Sep 13 '06 #13
kondal said:

<snip>
There is even better and faster algorithm but difficult to remember.

#define MASK_01010101 (((unsigned int)(-1))/3)
#define MASK_00110011 (((unsigned int)(-1))/5)
#define MASK_00001111 (((unsigned int)(-1))/17)

int bitcount (unsigned int n)
{
n = (n & MASK_01010101) + ((n >1) & MASK_01010101) ;
n = (n & MASK_00110011) + ((n >2) & MASK_00110011) ;
n = (n & MASK_00001111) + ((n >4) & MASK_00001111) ;
return n % 255 ;
}
What makes you think this is faster? And what happens when the code is
ported to a platform with 64-bit unsigned ints?

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Sep 13 '06 #14
Richard Heathfield wrote:
kondal said:

<snip>
There is even better and faster algorithm but difficult to remember.

#define MASK_01010101 (((unsigned int)(-1))/3)
#define MASK_00110011 (((unsigned int)(-1))/5)
#define MASK_00001111 (((unsigned int)(-1))/17)

int bitcount (unsigned int n)
{
n = (n & MASK_01010101) + ((n >1) & MASK_01010101) ;
n = (n & MASK_00110011) + ((n >2) & MASK_00110011) ;
n = (n & MASK_00001111) + ((n >4) & MASK_00001111) ;
return n % 255 ;
}

What makes you think this is faster? And what happens when the code is
ported to a platform with 64-bit unsigned ints?

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
There is no loop here to check and no of clock cycles to be executed
would be fas less than my previous algorithm.

Here is the program for 64 bits

#define MASK_01010101 (((unsigned int)(-1))/3)
#define MASK_00110011 (((unsigned int)(-1))/5)
#define MASK_00001111 (((unsigned int)(-1))/17)
#define MASK_00111100 (((unsigned int)(-1))/257)

int bitcount (unsigned int n)
{
n = (n & MASK_01010101) + ((n >1) & MASK_01010101) ;
n = (n & MASK_00110011) + ((n >2) & MASK_00110011) ;
n = (n & MASK_00001111) + ((n >4) & MASK_00001111) ;
n = (n & MASK_00111100) + ((n >8) & MASK_00111100) ;
return n % 255 ;
}

-kondal

Sep 13 '06 #15
kondal wrote:
>
#define MASK_01010101 (((unsigned int)(-1))/3)
#define MASK_00110011 (((unsigned int)(-1))/5)
#define MASK_00001111 (((unsigned int)(-1))/17)
#define MASK_00111100 (((unsigned int)(-1))/257)

int bitcount (unsigned int n)
{
n = (n & MASK_01010101) + ((n >1) & MASK_01010101) ;
n = (n & MASK_00110011) + ((n >2) & MASK_00110011) ;
n = (n & MASK_00001111) + ((n >4) & MASK_00001111) ;
n = (n & MASK_00111100) + ((n >8) & MASK_00111100) ;
return n % 255 ;
}
Sorry I forgot, 'unsigned int' should be replaced by to 'unsigned long
long int'

-kondal

Sep 13 '06 #16
kondal said:
Richard Heathfield wrote:
>kondal said:

<snip>
There is even better and faster algorithm but difficult to remember.

#define MASK_01010101 (((unsigned int)(-1))/3)
#define MASK_00110011 (((unsigned int)(-1))/5)
#define MASK_00001111 (((unsigned int)(-1))/17)

int bitcount (unsigned int n)
{
n = (n & MASK_01010101) + ((n >1) & MASK_01010101) ;
n = (n & MASK_00110011) + ((n >2) & MASK_00110011) ;
n = (n & MASK_00001111) + ((n >4) & MASK_00001111) ;
return n % 255 ;
}

What makes you think this is faster? And what happens when the code is
ported to a platform with 64-bit unsigned ints?
<snip>
>
Here is the program for 64 bits

#define MASK_01010101 (((unsigned int)(-1))/3)
#define MASK_00110011 (((unsigned int)(-1))/5)
#define MASK_00001111 (((unsigned int)(-1))/17)
#define MASK_00111100 (((unsigned int)(-1))/257)

int bitcount (unsigned int n)
{
n = (n & MASK_01010101) + ((n >1) & MASK_01010101) ;
n = (n & MASK_00110011) + ((n >2) & MASK_00110011) ;
n = (n & MASK_00001111) + ((n >4) & MASK_00001111) ;
n = (n & MASK_00111100) + ((n >8) & MASK_00111100) ;
return n % 255 ;
}
What happens when the code is ported to a platform with 180-bit ints?

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Sep 13 '06 #17
Richard Heathfield posted:
Your solution doesn't appear to cope with integers wider than 21 bits,
for a start. Secondly, it doesn't cope with integers that are /fewer/
than 21 bits wide! Thirdly, it could conceivably be counting "padding
bits", bits that do not contribute to the value of the integer.
<snip>
"If the value of the right operand is negative or is greater
than or equal to the width in bits of the promoted left operand, the
behavior is undefined."

I meant something more along the following lines. Do compilers nowadays
optimise away Bitwise-AND operations when one of the operands is known to
be 0 at compile-time?

/* Macro: QUANT_BITS_SET

This macro determines the quantity of bits which
are set in an integer expression whose signedness
is unsigned.

The typedef, "BitsSetTyp e", specifies the unsigned
integer type which is to be used for processing.

Before processing takes place, the argument is
converted to BitsSetType.

This macro should work with unsigned integer types
as wide as 1024 bits.

NB: This macro evaluates its argument more than once.
*/

typedef unsigned BitsSetType;

#define IMAX_BITS(m) (\
(m) /((m)%0x3fffffff L+1) /0x3fffffffL \
%0x3fffffffL *30 \
+ (m)%0x3fffffffL /((m)%31+1)/31%31*5 \
+ 4 \
- 12 / ((m)%31+3) )

#define MASK_ZERO_IF_OV ER(shift_left_b y) (\
shift_left_by < IMAX_BITS((Bits SetType)-1) \
? (BitsSetType)1 << shift_left_by \
: (BitsSetType)0 )

#define QUANT_BITS_SET_ RAW(x) (\
!!((x)&(BitsSet Type)1) + !!((x)&(BitsSet Type)1<<1) \
+!!((x)&(BitsSe tType)1<<2) + !!((x)&(BitsSet Type)1<<3) \
+!!((x)&(BitsSe tType)1<<4) + !!((x)&(BitsSet Type)1<<5) \
+!!((x)&(BitsSe tType)1<<6) + !!((x)&(BitsSet Type)1<<7) \
+!!((x)&(BitsSe tType)1<<8) + !!((x)&(BitsSet Type)1<<9) \
+!!((x)&(BitsSe tType)1<<10) +!!((x)&(BitsSe tType)1<<11) \
+!!((x)&(BitsSe tType)1<<12) +!!((x)&(BitsSe tType)1<<13) \
+!!((x)&(BitsSe tType)1<<14) +!!((x)&(BitsSe tType)1<<15) \
+!!((x)&MASK_ZE RO_IF_OVER(16)) +!!((x)&MASK_ZE RO_IF_OVER(17)) \
+!!((x)&MASK_ZE RO_IF_OVER(18)) +!!((x)&MASK_ZE RO_IF_OVER(19)) \
+!!((x)&MASK_ZE RO_IF_OVER(20)) +!!((x)&MASK_ZE RO_IF_OVER(21)) \
+!!((x)&MASK_ZE RO_IF_OVER(22)) +!!((x)&MASK_ZE RO_IF_OVER(23)) \
+!!((x)&MASK_ZE RO_IF_OVER(24)) +!!((x)&MASK_ZE RO_IF_OVER(25)) \
+!!((x)&MASK_ZE RO_IF_OVER(26)) +!!((x)&MASK_ZE RO_IF_OVER(27)) \
+!!((x)&MASK_ZE RO_IF_OVER(28)) +!!((x)&MASK_ZE RO_IF_OVER(29)) \
+!!((x)&MASK_ZE RO_IF_OVER(30)) +!!((x)&MASK_ZE RO_IF_OVER(31)) \
+!!((x)&MASK_ZE RO_IF_OVER(32)) +!!((x)&MASK_ZE RO_IF_OVER(33)) \
+!!((x)&MASK_ZE RO_IF_OVER(34)) +!!((x)&MASK_ZE RO_IF_OVER(35)) \
+!!((x)&MASK_ZE RO_IF_OVER(36)) +!!((x)&MASK_ZE RO_IF_OVER(37)) \
+!!((x)&MASK_ZE RO_IF_OVER(38)) +!!((x)&MASK_ZE RO_IF_OVER(39)) \
+!!((x)&MASK_ZE RO_IF_OVER(40)) +!!((x)&MASK_ZE RO_IF_OVER(41)) \
+!!((x)&MASK_ZE RO_IF_OVER(42)) +!!((x)&MASK_ZE RO_IF_OVER(43)) \
+!!((x)&MASK_ZE RO_IF_OVER(44)) +!!((x)&MASK_ZE RO_IF_OVER(45)) \
+!!((x)&MASK_ZE RO_IF_OVER(46)) +!!((x)&MASK_ZE RO_IF_OVER(47)) \
+!!((x)&MASK_ZE RO_IF_OVER(48)) +!!((x)&MASK_ZE RO_IF_OVER(49)) \
+!!((x)&MASK_ZE RO_IF_OVER(50)) +!!((x)&MASK_ZE RO_IF_OVER(51)) \
+!!((x)&MASK_ZE RO_IF_OVER(52)) +!!((x)&MASK_ZE RO_IF_OVER(53)) \
+!!((x)&MASK_ZE RO_IF_OVER(54)) +!!((x)&MASK_ZE RO_IF_OVER(55)) \
+!!((x)&MASK_ZE RO_IF_OVER(56)) +!!((x)&MASK_ZE RO_IF_OVER(57)) \
+!!((x)&MASK_ZE RO_IF_OVER(58)) +!!((x)&MASK_ZE RO_IF_OVER(59)) \
+!!((x)&MASK_ZE RO_IF_OVER(60)) +!!((x)&MASK_ZE RO_IF_OVER(61)) \
+!!((x)&MASK_ZE RO_IF_OVER(62)) +!!((x)&MASK_ZE RO_IF_OVER(63)) \
+!!((x)&MASK_ZE RO_IF_OVER(64)) +!!((x)&MASK_ZE RO_IF_OVER(65)) \
+!!((x)&MASK_ZE RO_IF_OVER(66)) +!!((x)&MASK_ZE RO_IF_OVER(67)) \
+!!((x)&MASK_ZE RO_IF_OVER(68)) +!!((x)&MASK_ZE RO_IF_OVER(69)) \
+!!((x)&MASK_ZE RO_IF_OVER(70)) +!!((x)&MASK_ZE RO_IF_OVER(71)) \
+!!((x)&MASK_ZE RO_IF_OVER(72)) +!!((x)&MASK_ZE RO_IF_OVER(73)) \
+!!((x)&MASK_ZE RO_IF_OVER(74)) +!!((x)&MASK_ZE RO_IF_OVER(75)) \
+!!((x)&MASK_ZE RO_IF_OVER(76)) +!!((x)&MASK_ZE RO_IF_OVER(77)) \
+!!((x)&MASK_ZE RO_IF_OVER(78)) +!!((x)&MASK_ZE RO_IF_OVER(79)) \
+!!((x)&MASK_ZE RO_IF_OVER(80)) +!!((x)&MASK_ZE RO_IF_OVER(81)) \
+!!((x)&MASK_ZE RO_IF_OVER(82)) +!!((x)&MASK_ZE RO_IF_OVER(83)) \
+!!((x)&MASK_ZE RO_IF_OVER(84)) +!!((x)&MASK_ZE RO_IF_OVER(85)) \
+!!((x)&MASK_ZE RO_IF_OVER(86)) +!!((x)&MASK_ZE RO_IF_OVER(87)) \
+!!((x)&MASK_ZE RO_IF_OVER(88)) +!!((x)&MASK_ZE RO_IF_OVER(89)) \
+!!((x)&MASK_ZE RO_IF_OVER(90)) +!!((x)&MASK_ZE RO_IF_OVER(91)) \
+!!((x)&MASK_ZE RO_IF_OVER(92)) +!!((x)&MASK_ZE RO_IF_OVER(93)) \
+!!((x)&MASK_ZE RO_IF_OVER(94)) +!!((x)&MASK_ZE RO_IF_OVER(95)) \
+!!((x)&MASK_ZE RO_IF_OVER(96)) +!!((x)&MASK_ZE RO_IF_OVER(97)) \
+!!((x)&MASK_ZE RO_IF_OVER(98)) +!!((x)&MASK_ZE RO_IF_OVER(99)) \
+!!((x)&MASK_ZE RO_IF_OVER(100) )+!!((x)&MASK_Z ERO_IF_OVER(101 ))\
+!!((x)&MASK_ZE RO_IF_OVER(102) )+!!((x)&MASK_Z ERO_IF_OVER(103 ))\
+!!((x)&MASK_ZE RO_IF_OVER(104) )+!!((x)&MASK_Z ERO_IF_OVER(105 ))\
+!!((x)&MASK_ZE RO_IF_OVER(106) )+!!((x)&MASK_Z ERO_IF_OVER(107 ))\
+!!((x)&MASK_ZE RO_IF_OVER(108) )+!!((x)&MASK_Z ERO_IF_OVER(109 ))\
+!!((x)&MASK_ZE RO_IF_OVER(110) )+!!((x)&MASK_Z ERO_IF_OVER(111 ))\
+!!((x)&MASK_ZE RO_IF_OVER(112) )+!!((x)&MASK_Z ERO_IF_OVER(113 ))\
+!!((x)&MASK_ZE RO_IF_OVER(114) )+!!((x)&MASK_Z ERO_IF_OVER(115 ))\
+!!((x)&MASK_ZE RO_IF_OVER(116) )+!!((x)&MASK_Z ERO_IF_OVER(117 ))\
+!!((x)&MASK_ZE RO_IF_OVER(118) )+!!((x)&MASK_Z ERO_IF_OVER(119 ))\
+!!((x)&MASK_ZE RO_IF_OVER(120) )+!!((x)&MASK_Z ERO_IF_OVER(121 ))\
+!!((x)&MASK_ZE RO_IF_OVER(122) )+!!((x)&MASK_Z ERO_IF_OVER(123 ))\
+!!((x)&MASK_ZE RO_IF_OVER(124) )+!!((x)&MASK_Z ERO_IF_OVER(125 ))\
+!!((x)&MASK_ZE RO_IF_OVER(126) )+!!((x)&MASK_Z ERO_IF_OVER(127 ))\
+!!((x)&MASK_ZE RO_IF_OVER(128) )+!!((x)&MASK_Z ERO_IF_OVER(129 ))\
+!!((x)&MASK_ZE RO_IF_OVER(130) )+!!((x)&MASK_Z ERO_IF_OVER(131 ))\
+!!((x)&MASK_ZE RO_IF_OVER(132) )+!!((x)&MASK_Z ERO_IF_OVER(133 ))\
+!!((x)&MASK_ZE RO_IF_OVER(134) )+!!((x)&MASK_Z ERO_IF_OVER(135 ))\
+!!((x)&MASK_ZE RO_IF_OVER(136) )+!!((x)&MASK_Z ERO_IF_OVER(137 ))\
+!!((x)&MASK_ZE RO_IF_OVER(138) )+!!((x)&MASK_Z ERO_IF_OVER(139 ))\
+!!((x)&MASK_ZE RO_IF_OVER(140) )+!!((x)&MASK_Z ERO_IF_OVER(141 ))\
+!!((x)&MASK_ZE RO_IF_OVER(142) )+!!((x)&MASK_Z ERO_IF_OVER(143 ))\
+!!((x)&MASK_ZE RO_IF_OVER(144) )+!!((x)&MASK_Z ERO_IF_OVER(145 ))\
+!!((x)&MASK_ZE RO_IF_OVER(146) )+!!((x)&MASK_Z ERO_IF_OVER(147 ))\
+!!((x)&MASK_ZE RO_IF_OVER(148) )+!!((x)&MASK_Z ERO_IF_OVER(149 ))\
+!!((x)&MASK_ZE RO_IF_OVER(150) )+!!((x)&MASK_Z ERO_IF_OVER(151 ))\
+!!((x)&MASK_ZE RO_IF_OVER(152) )+!!((x)&MASK_Z ERO_IF_OVER(153 ))\
+!!((x)&MASK_ZE RO_IF_OVER(154) )+!!((x)&MASK_Z ERO_IF_OVER(155 ))\
+!!((x)&MASK_ZE RO_IF_OVER(156) )+!!((x)&MASK_Z ERO_IF_OVER(157 ))\
+!!((x)&MASK_ZE RO_IF_OVER(158) )+!!((x)&MASK_Z ERO_IF_OVER(159 ))\
+!!((x)&MASK_ZE RO_IF_OVER(160) )+!!((x)&MASK_Z ERO_IF_OVER(161 ))\
+!!((x)&MASK_ZE RO_IF_OVER(162) )+!!((x)&MASK_Z ERO_IF_OVER(163 ))\
+!!((x)&MASK_ZE RO_IF_OVER(164) )+!!((x)&MASK_Z ERO_IF_OVER(165 ))\
+!!((x)&MASK_ZE RO_IF_OVER(166) )+!!((x)&MASK_Z ERO_IF_OVER(167 ))\
+!!((x)&MASK_ZE RO_IF_OVER(168) )+!!((x)&MASK_Z ERO_IF_OVER(169 ))\
+!!((x)&MASK_ZE RO_IF_OVER(170) )+!!((x)&MASK_Z ERO_IF_OVER(171 ))\
+!!((x)&MASK_ZE RO_IF_OVER(172) )+!!((x)&MASK_Z ERO_IF_OVER(173 ))\
+!!((x)&MASK_ZE RO_IF_OVER(174) )+!!((x)&MASK_Z ERO_IF_OVER(175 ))\
+!!((x)&MASK_ZE RO_IF_OVER(176) )+!!((x)&MASK_Z ERO_IF_OVER(177 ))\
+!!((x)&MASK_ZE RO_IF_OVER(178) )+!!((x)&MASK_Z ERO_IF_OVER(179 ))\
+!!((x)&MASK_ZE RO_IF_OVER(180) )+!!((x)&MASK_Z ERO_IF_OVER(181 ))\
+!!((x)&MASK_ZE RO_IF_OVER(182) )+!!((x)&MASK_Z ERO_IF_OVER(183 ))\
+!!((x)&MASK_ZE RO_IF_OVER(184) )+!!((x)&MASK_Z ERO_IF_OVER(185 ))\
+!!((x)&MASK_ZE RO_IF_OVER(186) )+!!((x)&MASK_Z ERO_IF_OVER(187 ))\
+!!((x)&MASK_ZE RO_IF_OVER(188) )+!!((x)&MASK_Z ERO_IF_OVER(189 ))\
+!!((x)&MASK_ZE RO_IF_OVER(190) )+!!((x)&MASK_Z ERO_IF_OVER(191 ))\
+!!((x)&MASK_ZE RO_IF_OVER(192) )+!!((x)&MASK_Z ERO_IF_OVER(193 ))\
+!!((x)&MASK_ZE RO_IF_OVER(194) )+!!((x)&MASK_Z ERO_IF_OVER(195 ))\
+!!((x)&MASK_ZE RO_IF_OVER(196) )+!!((x)&MASK_Z ERO_IF_OVER(197 ))\
+!!((x)&MASK_ZE RO_IF_OVER(198) )+!!((x)&MASK_Z ERO_IF_OVER(199 ))\
+!!((x)&MASK_ZE RO_IF_OVER(200) )+!!((x)&MASK_Z ERO_IF_OVER(201 ))\
+!!((x)&MASK_ZE RO_IF_OVER(202) )+!!((x)&MASK_Z ERO_IF_OVER(203 ))\
+!!((x)&MASK_ZE RO_IF_OVER(204) )+!!((x)&MASK_Z ERO_IF_OVER(205 ))\
+!!((x)&MASK_ZE RO_IF_OVER(206) )+!!((x)&MASK_Z ERO_IF_OVER(207 ))\
+!!((x)&MASK_ZE RO_IF_OVER(208) )+!!((x)&MASK_Z ERO_IF_OVER(209 ))\
+!!((x)&MASK_ZE RO_IF_OVER(210) )+!!((x)&MASK_Z ERO_IF_OVER(211 ))\
+!!((x)&MASK_ZE RO_IF_OVER(212) )+!!((x)&MASK_Z ERO_IF_OVER(213 ))\
+!!((x)&MASK_ZE RO_IF_OVER(214) )+!!((x)&MASK_Z ERO_IF_OVER(215 ))\
+!!((x)&MASK_ZE RO_IF_OVER(216) )+!!((x)&MASK_Z ERO_IF_OVER(217 ))\
+!!((x)&MASK_ZE RO_IF_OVER(218) )+!!((x)&MASK_Z ERO_IF_OVER(219 ))\
+!!((x)&MASK_ZE RO_IF_OVER(220) )+!!((x)&MASK_Z ERO_IF_OVER(221 ))\
+!!((x)&MASK_ZE RO_IF_OVER(222) )+!!((x)&MASK_Z ERO_IF_OVER(223 ))\
+!!((x)&MASK_ZE RO_IF_OVER(224) )+!!((x)&MASK_Z ERO_IF_OVER(225 ))\
+!!((x)&MASK_ZE RO_IF_OVER(226) )+!!((x)&MASK_Z ERO_IF_OVER(227 ))\
+!!((x)&MASK_ZE RO_IF_OVER(228) )+!!((x)&MASK_Z ERO_IF_OVER(229 ))\
+!!((x)&MASK_ZE RO_IF_OVER(230) )+!!((x)&MASK_Z ERO_IF_OVER(231 ))\
+!!((x)&MASK_ZE RO_IF_OVER(232) )+!!((x)&MASK_Z ERO_IF_OVER(233 ))\
+!!((x)&MASK_ZE RO_IF_OVER(234) )+!!((x)&MASK_Z ERO_IF_OVER(235 ))\
+!!((x)&MASK_ZE RO_IF_OVER(236) )+!!((x)&MASK_Z ERO_IF_OVER(237 ))\
+!!((x)&MASK_ZE RO_IF_OVER(238) )+!!((x)&MASK_Z ERO_IF_OVER(239 ))\
+!!((x)&MASK_ZE RO_IF_OVER(240) )+!!((x)&MASK_Z ERO_IF_OVER(241 ))\
+!!((x)&MASK_ZE RO_IF_OVER(242) )+!!((x)&MASK_Z ERO_IF_OVER(243 ))\
+!!((x)&MASK_ZE RO_IF_OVER(244) )+!!((x)&MASK_Z ERO_IF_OVER(245 ))\
+!!((x)&MASK_ZE RO_IF_OVER(246) )+!!((x)&MASK_Z ERO_IF_OVER(247 ))\
+!!((x)&MASK_ZE RO_IF_OVER(248) )+!!((x)&MASK_Z ERO_IF_OVER(249 ))\
+!!((x)&MASK_ZE RO_IF_OVER(250) )+!!((x)&MASK_Z ERO_IF_OVER(251 ))\
+!!((x)&MASK_ZE RO_IF_OVER(252) )+!!((x)&MASK_Z ERO_IF_OVER(253 ))\
+!!((x)&MASK_ZE RO_IF_OVER(254) )+!!((x)&MASK_Z ERO_IF_OVER(255 ))\
+!!((x)&MASK_ZE RO_IF_OVER(256) )+!!((x)&MASK_Z ERO_IF_OVER(257 ))\
+!!((x)&MASK_ZE RO_IF_OVER(258) )+!!((x)&MASK_Z ERO_IF_OVER(259 ))\
+!!((x)&MASK_ZE RO_IF_OVER(260) )+!!((x)&MASK_Z ERO_IF_OVER(261 ))\
+!!((x)&MASK_ZE RO_IF_OVER(262) )+!!((x)&MASK_Z ERO_IF_OVER(263 ))\
+!!((x)&MASK_ZE RO_IF_OVER(264) )+!!((x)&MASK_Z ERO_IF_OVER(265 ))\
+!!((x)&MASK_ZE RO_IF_OVER(266) )+!!((x)&MASK_Z ERO_IF_OVER(267 ))\
+!!((x)&MASK_ZE RO_IF_OVER(268) )+!!((x)&MASK_Z ERO_IF_OVER(269 ))\
+!!((x)&MASK_ZE RO_IF_OVER(270) )+!!((x)&MASK_Z ERO_IF_OVER(271 ))\
+!!((x)&MASK_ZE RO_IF_OVER(272) )+!!((x)&MASK_Z ERO_IF_OVER(273 ))\
+!!((x)&MASK_ZE RO_IF_OVER(274) )+!!((x)&MASK_Z ERO_IF_OVER(275 ))\
+!!((x)&MASK_ZE RO_IF_OVER(276) )+!!((x)&MASK_Z ERO_IF_OVER(277 ))\
+!!((x)&MASK_ZE RO_IF_OVER(278) )+!!((x)&MASK_Z ERO_IF_OVER(279 ))\
+!!((x)&MASK_ZE RO_IF_OVER(280) )+!!((x)&MASK_Z ERO_IF_OVER(281 ))\
+!!((x)&MASK_ZE RO_IF_OVER(282) )+!!((x)&MASK_Z ERO_IF_OVER(283 ))\
+!!((x)&MASK_ZE RO_IF_OVER(284) )+!!((x)&MASK_Z ERO_IF_OVER(285 ))\
+!!((x)&MASK_ZE RO_IF_OVER(286) )+!!((x)&MASK_Z ERO_IF_OVER(287 ))\
+!!((x)&MASK_ZE RO_IF_OVER(288) )+!!((x)&MASK_Z ERO_IF_OVER(289 ))\
+!!((x)&MASK_ZE RO_IF_OVER(290) )+!!((x)&MASK_Z ERO_IF_OVER(291 ))\
+!!((x)&MASK_ZE RO_IF_OVER(292) )+!!((x)&MASK_Z ERO_IF_OVER(293 ))\
+!!((x)&MASK_ZE RO_IF_OVER(294) )+!!((x)&MASK_Z ERO_IF_OVER(295 ))\
+!!((x)&MASK_ZE RO_IF_OVER(296) )+!!((x)&MASK_Z ERO_IF_OVER(297 ))\
+!!((x)&MASK_ZE RO_IF_OVER(298) )+!!((x)&MASK_Z ERO_IF_OVER(299 ))\
+!!((x)&MASK_ZE RO_IF_OVER(300) )+!!((x)&MASK_Z ERO_IF_OVER(301 ))\
+!!((x)&MASK_ZE RO_IF_OVER(302) )+!!((x)&MASK_Z ERO_IF_OVER(303 ))\
+!!((x)&MASK_ZE RO_IF_OVER(304) )+!!((x)&MASK_Z ERO_IF_OVER(305 ))\
+!!((x)&MASK_ZE RO_IF_OVER(306) )+!!((x)&MASK_Z ERO_IF_OVER(307 ))\
+!!((x)&MASK_ZE RO_IF_OVER(308) )+!!((x)&MASK_Z ERO_IF_OVER(309 ))\
+!!((x)&MASK_ZE RO_IF_OVER(310) )+!!((x)&MASK_Z ERO_IF_OVER(311 ))\
+!!((x)&MASK_ZE RO_IF_OVER(312) )+!!((x)&MASK_Z ERO_IF_OVER(313 ))\
+!!((x)&MASK_ZE RO_IF_OVER(314) )+!!((x)&MASK_Z ERO_IF_OVER(315 ))\
+!!((x)&MASK_ZE RO_IF_OVER(316) )+!!((x)&MASK_Z ERO_IF_OVER(317 ))\
+!!((x)&MASK_ZE RO_IF_OVER(318) )+!!((x)&MASK_Z ERO_IF_OVER(319 ))\
+!!((x)&MASK_ZE RO_IF_OVER(320) )+!!((x)&MASK_Z ERO_IF_OVER(321 ))\
+!!((x)&MASK_ZE RO_IF_OVER(322) )+!!((x)&MASK_Z ERO_IF_OVER(323 ))\
+!!((x)&MASK_ZE RO_IF_OVER(324) )+!!((x)&MASK_Z ERO_IF_OVER(325 ))\
+!!((x)&MASK_ZE RO_IF_OVER(326) )+!!((x)&MASK_Z ERO_IF_OVER(327 ))\
+!!((x)&MASK_ZE RO_IF_OVER(328) )+!!((x)&MASK_Z ERO_IF_OVER(329 ))\
+!!((x)&MASK_ZE RO_IF_OVER(330) )+!!((x)&MASK_Z ERO_IF_OVER(331 ))\
+!!((x)&MASK_ZE RO_IF_OVER(332) )+!!((x)&MASK_Z ERO_IF_OVER(333 ))\
+!!((x)&MASK_ZE RO_IF_OVER(334) )+!!((x)&MASK_Z ERO_IF_OVER(335 ))\
+!!((x)&MASK_ZE RO_IF_OVER(336) )+!!((x)&MASK_Z ERO_IF_OVER(337 ))\
+!!((x)&MASK_ZE RO_IF_OVER(338) )+!!((x)&MASK_Z ERO_IF_OVER(339 ))\
+!!((x)&MASK_ZE RO_IF_OVER(340) )+!!((x)&MASK_Z ERO_IF_OVER(341 ))\
+!!((x)&MASK_ZE RO_IF_OVER(342) )+!!((x)&MASK_Z ERO_IF_OVER(343 ))\
+!!((x)&MASK_ZE RO_IF_OVER(344) )+!!((x)&MASK_Z ERO_IF_OVER(345 ))\
+!!((x)&MASK_ZE RO_IF_OVER(346) )+!!((x)&MASK_Z ERO_IF_OVER(347 ))\
+!!((x)&MASK_ZE RO_IF_OVER(348) )+!!((x)&MASK_Z ERO_IF_OVER(349 ))\
+!!((x)&MASK_ZE RO_IF_OVER(350) )+!!((x)&MASK_Z ERO_IF_OVER(351 ))\
+!!((x)&MASK_ZE RO_IF_OVER(352) )+!!((x)&MASK_Z ERO_IF_OVER(353 ))\
+!!((x)&MASK_ZE RO_IF_OVER(354) )+!!((x)&MASK_Z ERO_IF_OVER(355 ))\
+!!((x)&MASK_ZE RO_IF_OVER(356) )+!!((x)&MASK_Z ERO_IF_OVER(357 ))\
+!!((x)&MASK_ZE RO_IF_OVER(358) )+!!((x)&MASK_Z ERO_IF_OVER(359 ))\
+!!((x)&MASK_ZE RO_IF_OVER(360) )+!!((x)&MASK_Z ERO_IF_OVER(361 ))\
+!!((x)&MASK_ZE RO_IF_OVER(362) )+!!((x)&MASK_Z ERO_IF_OVER(363 ))\
+!!((x)&MASK_ZE RO_IF_OVER(364) )+!!((x)&MASK_Z ERO_IF_OVER(365 ))\
+!!((x)&MASK_ZE RO_IF_OVER(366) )+!!((x)&MASK_Z ERO_IF_OVER(367 ))\
+!!((x)&MASK_ZE RO_IF_OVER(368) )+!!((x)&MASK_Z ERO_IF_OVER(369 ))\
+!!((x)&MASK_ZE RO_IF_OVER(370) )+!!((x)&MASK_Z ERO_IF_OVER(371 ))\
+!!((x)&MASK_ZE RO_IF_OVER(372) )+!!((x)&MASK_Z ERO_IF_OVER(373 ))\
+!!((x)&MASK_ZE RO_IF_OVER(374) )+!!((x)&MASK_Z ERO_IF_OVER(375 ))\
+!!((x)&MASK_ZE RO_IF_OVER(376) )+!!((x)&MASK_Z ERO_IF_OVER(377 ))\
+!!((x)&MASK_ZE RO_IF_OVER(378) )+!!((x)&MASK_Z ERO_IF_OVER(379 ))\
+!!((x)&MASK_ZE RO_IF_OVER(380) )+!!((x)&MASK_Z ERO_IF_OVER(381 ))\
+!!((x)&MASK_ZE RO_IF_OVER(382) )+!!((x)&MASK_Z ERO_IF_OVER(383 ))\
+!!((x)&MASK_ZE RO_IF_OVER(384) )+!!((x)&MASK_Z ERO_IF_OVER(385 ))\
+!!((x)&MASK_ZE RO_IF_OVER(386) )+!!((x)&MASK_Z ERO_IF_OVER(387 ))\
+!!((x)&MASK_ZE RO_IF_OVER(388) )+!!((x)&MASK_Z ERO_IF_OVER(389 ))\
+!!((x)&MASK_ZE RO_IF_OVER(390) )+!!((x)&MASK_Z ERO_IF_OVER(391 ))\
+!!((x)&MASK_ZE RO_IF_OVER(392) )+!!((x)&MASK_Z ERO_IF_OVER(393 ))\
+!!((x)&MASK_ZE RO_IF_OVER(394) )+!!((x)&MASK_Z ERO_IF_OVER(395 ))\
+!!((x)&MASK_ZE RO_IF_OVER(396) )+!!((x)&MASK_Z ERO_IF_OVER(397 ))\
+!!((x)&MASK_ZE RO_IF_OVER(398) )+!!((x)&MASK_Z ERO_IF_OVER(399 ))\
+!!((x)&MASK_ZE RO_IF_OVER(400) )+!!((x)&MASK_Z ERO_IF_OVER(401 ))\
+!!((x)&MASK_ZE RO_IF_OVER(402) )+!!((x)&MASK_Z ERO_IF_OVER(403 ))\
+!!((x)&MASK_ZE RO_IF_OVER(404) )+!!((x)&MASK_Z ERO_IF_OVER(405 ))\
+!!((x)&MASK_ZE RO_IF_OVER(406) )+!!((x)&MASK_Z ERO_IF_OVER(407 ))\
+!!((x)&MASK_ZE RO_IF_OVER(408) )+!!((x)&MASK_Z ERO_IF_OVER(409 ))\
+!!((x)&MASK_ZE RO_IF_OVER(410) )+!!((x)&MASK_Z ERO_IF_OVER(411 ))\
+!!((x)&MASK_ZE RO_IF_OVER(412) )+!!((x)&MASK_Z ERO_IF_OVER(413 ))\
+!!((x)&MASK_ZE RO_IF_OVER(414) )+!!((x)&MASK_Z ERO_IF_OVER(415 ))\
+!!((x)&MASK_ZE RO_IF_OVER(416) )+!!((x)&MASK_Z ERO_IF_OVER(417 ))\
+!!((x)&MASK_ZE RO_IF_OVER(418) )+!!((x)&MASK_Z ERO_IF_OVER(419 ))\
+!!((x)&MASK_ZE RO_IF_OVER(420) )+!!((x)&MASK_Z ERO_IF_OVER(421 ))\
+!!((x)&MASK_ZE RO_IF_OVER(422) )+!!((x)&MASK_Z ERO_IF_OVER(423 ))\
+!!((x)&MASK_ZE RO_IF_OVER(424) )+!!((x)&MASK_Z ERO_IF_OVER(425 ))\
+!!((x)&MASK_ZE RO_IF_OVER(426) )+!!((x)&MASK_Z ERO_IF_OVER(427 ))\
+!!((x)&MASK_ZE RO_IF_OVER(428) )+!!((x)&MASK_Z ERO_IF_OVER(429 ))\
+!!((x)&MASK_ZE RO_IF_OVER(430) )+!!((x)&MASK_Z ERO_IF_OVER(431 ))\
+!!((x)&MASK_ZE RO_IF_OVER(432) )+!!((x)&MASK_Z ERO_IF_OVER(433 ))\
+!!((x)&MASK_ZE RO_IF_OVER(434) )+!!((x)&MASK_Z ERO_IF_OVER(435 ))\
+!!((x)&MASK_ZE RO_IF_OVER(436) )+!!((x)&MASK_Z ERO_IF_OVER(437 ))\
+!!((x)&MASK_ZE RO_IF_OVER(438) )+!!((x)&MASK_Z ERO_IF_OVER(439 ))\
+!!((x)&MASK_ZE RO_IF_OVER(440) )+!!((x)&MASK_Z ERO_IF_OVER(441 ))\
+!!((x)&MASK_ZE RO_IF_OVER(442) )+!!((x)&MASK_Z ERO_IF_OVER(443 ))\
+!!((x)&MASK_ZE RO_IF_OVER(444) )+!!((x)&MASK_Z ERO_IF_OVER(445 ))\
+!!((x)&MASK_ZE RO_IF_OVER(446) )+!!((x)&MASK_Z ERO_IF_OVER(447 ))\
+!!((x)&MASK_ZE RO_IF_OVER(448) )+!!((x)&MASK_Z ERO_IF_OVER(449 ))\
+!!((x)&MASK_ZE RO_IF_OVER(450) )+!!((x)&MASK_Z ERO_IF_OVER(451 ))\
+!!((x)&MASK_ZE RO_IF_OVER(452) )+!!((x)&MASK_Z ERO_IF_OVER(453 ))\
+!!((x)&MASK_ZE RO_IF_OVER(454) )+!!((x)&MASK_Z ERO_IF_OVER(455 ))\
+!!((x)&MASK_ZE RO_IF_OVER(456) )+!!((x)&MASK_Z ERO_IF_OVER(457 ))\
+!!((x)&MASK_ZE RO_IF_OVER(458) )+!!((x)&MASK_Z ERO_IF_OVER(459 ))\
+!!((x)&MASK_ZE RO_IF_OVER(460) )+!!((x)&MASK_Z ERO_IF_OVER(461 ))\
+!!((x)&MASK_ZE RO_IF_OVER(462) )+!!((x)&MASK_Z ERO_IF_OVER(463 ))\
+!!((x)&MASK_ZE RO_IF_OVER(464) )+!!((x)&MASK_Z ERO_IF_OVER(465 ))\
+!!((x)&MASK_ZE RO_IF_OVER(466) )+!!((x)&MASK_Z ERO_IF_OVER(467 ))\
+!!((x)&MASK_ZE RO_IF_OVER(468) )+!!((x)&MASK_Z ERO_IF_OVER(469 ))\
+!!((x)&MASK_ZE RO_IF_OVER(470) )+!!((x)&MASK_Z ERO_IF_OVER(471 ))\
+!!((x)&MASK_ZE RO_IF_OVER(472) )+!!((x)&MASK_Z ERO_IF_OVER(473 ))\
+!!((x)&MASK_ZE RO_IF_OVER(474) )+!!((x)&MASK_Z ERO_IF_OVER(475 ))\
+!!((x)&MASK_ZE RO_IF_OVER(476) )+!!((x)&MASK_Z ERO_IF_OVER(477 ))\
+!!((x)&MASK_ZE RO_IF_OVER(478) )+!!((x)&MASK_Z ERO_IF_OVER(479 ))\
+!!((x)&MASK_ZE RO_IF_OVER(480) )+!!((x)&MASK_Z ERO_IF_OVER(481 ))\
+!!((x)&MASK_ZE RO_IF_OVER(482) )+!!((x)&MASK_Z ERO_IF_OVER(483 ))\
+!!((x)&MASK_ZE RO_IF_OVER(484) )+!!((x)&MASK_Z ERO_IF_OVER(485 ))\
+!!((x)&MASK_ZE RO_IF_OVER(486) )+!!((x)&MASK_Z ERO_IF_OVER(487 ))\
+!!((x)&MASK_ZE RO_IF_OVER(488) )+!!((x)&MASK_Z ERO_IF_OVER(489 ))\
+!!((x)&MASK_ZE RO_IF_OVER(490) )+!!((x)&MASK_Z ERO_IF_OVER(491 ))\
+!!((x)&MASK_ZE RO_IF_OVER(492) )+!!((x)&MASK_Z ERO_IF_OVER(493 ))\
+!!((x)&MASK_ZE RO_IF_OVER(494) )+!!((x)&MASK_Z ERO_IF_OVER(495 ))\
+!!((x)&MASK_ZE RO_IF_OVER(496) )+!!((x)&MASK_Z ERO_IF_OVER(497 ))\
+!!((x)&MASK_ZE RO_IF_OVER(498) )+!!((x)&MASK_Z ERO_IF_OVER(499 ))\
+!!((x)&MASK_ZE RO_IF_OVER(500) )+!!((x)&MASK_Z ERO_IF_OVER(501 ))\
+!!((x)&MASK_ZE RO_IF_OVER(502) )+!!((x)&MASK_Z ERO_IF_OVER(503 ))\
+!!((x)&MASK_ZE RO_IF_OVER(504) )+!!((x)&MASK_Z ERO_IF_OVER(505 ))\
+!!((x)&MASK_ZE RO_IF_OVER(506) )+!!((x)&MASK_Z ERO_IF_OVER(507 ))\
+!!((x)&MASK_ZE RO_IF_OVER(508) )+!!((x)&MASK_Z ERO_IF_OVER(509 ))\
+!!((x)&MASK_ZE RO_IF_OVER(510) )+!!((x)&MASK_Z ERO_IF_OVER(511 ))\
+!!((x)&MASK_ZE RO_IF_OVER(512) )+!!((x)&MASK_Z ERO_IF_OVER(513 ))\
+!!((x)&MASK_ZE RO_IF_OVER(514) )+!!((x)&MASK_Z ERO_IF_OVER(515 ))\
+!!((x)&MASK_ZE RO_IF_OVER(516) )+!!((x)&MASK_Z ERO_IF_OVER(517 ))\
+!!((x)&MASK_ZE RO_IF_OVER(518) )+!!((x)&MASK_Z ERO_IF_OVER(519 ))\
+!!((x)&MASK_ZE RO_IF_OVER(520) )+!!((x)&MASK_Z ERO_IF_OVER(521 ))\
+!!((x)&MASK_ZE RO_IF_OVER(522) )+!!((x)&MASK_Z ERO_IF_OVER(523 ))\
+!!((x)&MASK_ZE RO_IF_OVER(524) )+!!((x)&MASK_Z ERO_IF_OVER(525 ))\
+!!((x)&MASK_ZE RO_IF_OVER(526) )+!!((x)&MASK_Z ERO_IF_OVER(527 ))\
+!!((x)&MASK_ZE RO_IF_OVER(528) )+!!((x)&MASK_Z ERO_IF_OVER(529 ))\
+!!((x)&MASK_ZE RO_IF_OVER(530) )+!!((x)&MASK_Z ERO_IF_OVER(531 ))\
+!!((x)&MASK_ZE RO_IF_OVER(532) )+!!((x)&MASK_Z ERO_IF_OVER(533 ))\
+!!((x)&MASK_ZE RO_IF_OVER(534) )+!!((x)&MASK_Z ERO_IF_OVER(535 ))\
+!!((x)&MASK_ZE RO_IF_OVER(536) )+!!((x)&MASK_Z ERO_IF_OVER(537 ))\
+!!((x)&MASK_ZE RO_IF_OVER(538) )+!!((x)&MASK_Z ERO_IF_OVER(539 ))\
+!!((x)&MASK_ZE RO_IF_OVER(540) )+!!((x)&MASK_Z ERO_IF_OVER(541 ))\
+!!((x)&MASK_ZE RO_IF_OVER(542) )+!!((x)&MASK_Z ERO_IF_OVER(543 ))\
+!!((x)&MASK_ZE RO_IF_OVER(544) )+!!((x)&MASK_Z ERO_IF_OVER(545 ))\
+!!((x)&MASK_ZE RO_IF_OVER(546) )+!!((x)&MASK_Z ERO_IF_OVER(547 ))\
+!!((x)&MASK_ZE RO_IF_OVER(548) )+!!((x)&MASK_Z ERO_IF_OVER(549 ))\
+!!((x)&MASK_ZE RO_IF_OVER(550) )+!!((x)&MASK_Z ERO_IF_OVER(551 ))\
+!!((x)&MASK_ZE RO_IF_OVER(552) )+!!((x)&MASK_Z ERO_IF_OVER(553 ))\
+!!((x)&MASK_ZE RO_IF_OVER(554) )+!!((x)&MASK_Z ERO_IF_OVER(555 ))\
+!!((x)&MASK_ZE RO_IF_OVER(556) )+!!((x)&MASK_Z ERO_IF_OVER(557 ))\
+!!((x)&MASK_ZE RO_IF_OVER(558) )+!!((x)&MASK_Z ERO_IF_OVER(559 ))\
+!!((x)&MASK_ZE RO_IF_OVER(560) )+!!((x)&MASK_Z ERO_IF_OVER(561 ))\
+!!((x)&MASK_ZE RO_IF_OVER(562) )+!!((x)&MASK_Z ERO_IF_OVER(563 ))\
+!!((x)&MASK_ZE RO_IF_OVER(564) )+!!((x)&MASK_Z ERO_IF_OVER(565 ))\
+!!((x)&MASK_ZE RO_IF_OVER(566) )+!!((x)&MASK_Z ERO_IF_OVER(567 ))\
+!!((x)&MASK_ZE RO_IF_OVER(568) )+!!((x)&MASK_Z ERO_IF_OVER(569 ))\
+!!((x)&MASK_ZE RO_IF_OVER(570) )+!!((x)&MASK_Z ERO_IF_OVER(571 ))\
+!!((x)&MASK_ZE RO_IF_OVER(572) )+!!((x)&MASK_Z ERO_IF_OVER(573 ))\
+!!((x)&MASK_ZE RO_IF_OVER(574) )+!!((x)&MASK_Z ERO_IF_OVER(575 ))\
+!!((x)&MASK_ZE RO_IF_OVER(576) )+!!((x)&MASK_Z ERO_IF_OVER(577 ))\
+!!((x)&MASK_ZE RO_IF_OVER(578) )+!!((x)&MASK_Z ERO_IF_OVER(579 ))\
+!!((x)&MASK_ZE RO_IF_OVER(580) )+!!((x)&MASK_Z ERO_IF_OVER(581 ))\
+!!((x)&MASK_ZE RO_IF_OVER(582) )+!!((x)&MASK_Z ERO_IF_OVER(583 ))\
+!!((x)&MASK_ZE RO_IF_OVER(584) )+!!((x)&MASK_Z ERO_IF_OVER(585 ))\
+!!((x)&MASK_ZE RO_IF_OVER(586) )+!!((x)&MASK_Z ERO_IF_OVER(587 ))\
+!!((x)&MASK_ZE RO_IF_OVER(588) )+!!((x)&MASK_Z ERO_IF_OVER(589 ))\
+!!((x)&MASK_ZE RO_IF_OVER(590) )+!!((x)&MASK_Z ERO_IF_OVER(591 ))\
+!!((x)&MASK_ZE RO_IF_OVER(592) )+!!((x)&MASK_Z ERO_IF_OVER(593 ))\
+!!((x)&MASK_ZE RO_IF_OVER(594) )+!!((x)&MASK_Z ERO_IF_OVER(595 ))\
+!!((x)&MASK_ZE RO_IF_OVER(596) )+!!((x)&MASK_Z ERO_IF_OVER(597 ))\
+!!((x)&MASK_ZE RO_IF_OVER(598) )+!!((x)&MASK_Z ERO_IF_OVER(599 ))\
+!!((x)&MASK_ZE RO_IF_OVER(600) )+!!((x)&MASK_Z ERO_IF_OVER(601 ))\
+!!((x)&MASK_ZE RO_IF_OVER(602) )+!!((x)&MASK_Z ERO_IF_OVER(603 ))\
+!!((x)&MASK_ZE RO_IF_OVER(604) )+!!((x)&MASK_Z ERO_IF_OVER(605 ))\
+!!((x)&MASK_ZE RO_IF_OVER(606) )+!!((x)&MASK_Z ERO_IF_OVER(607 ))\
+!!((x)&MASK_ZE RO_IF_OVER(608) )+!!((x)&MASK_Z ERO_IF_OVER(609 ))\
+!!((x)&MASK_ZE RO_IF_OVER(610) )+!!((x)&MASK_Z ERO_IF_OVER(611 ))\
+!!((x)&MASK_ZE RO_IF_OVER(612) )+!!((x)&MASK_Z ERO_IF_OVER(613 ))\
+!!((x)&MASK_ZE RO_IF_OVER(614) )+!!((x)&MASK_Z ERO_IF_OVER(615 ))\
+!!((x)&MASK_ZE RO_IF_OVER(616) )+!!((x)&MASK_Z ERO_IF_OVER(617 ))\
+!!((x)&MASK_ZE RO_IF_OVER(618) )+!!((x)&MASK_Z ERO_IF_OVER(619 ))\
+!!((x)&MASK_ZE RO_IF_OVER(620) )+!!((x)&MASK_Z ERO_IF_OVER(621 ))\
+!!((x)&MASK_ZE RO_IF_OVER(622) )+!!((x)&MASK_Z ERO_IF_OVER(623 ))\
+!!((x)&MASK_ZE RO_IF_OVER(624) )+!!((x)&MASK_Z ERO_IF_OVER(625 ))\
+!!((x)&MASK_ZE RO_IF_OVER(626) )+!!((x)&MASK_Z ERO_IF_OVER(627 ))\
+!!((x)&MASK_ZE RO_IF_OVER(628) )+!!((x)&MASK_Z ERO_IF_OVER(629 ))\
+!!((x)&MASK_ZE RO_IF_OVER(630) )+!!((x)&MASK_Z ERO_IF_OVER(631 ))\
+!!((x)&MASK_ZE RO_IF_OVER(632) )+!!((x)&MASK_Z ERO_IF_OVER(633 ))\
+!!((x)&MASK_ZE RO_IF_OVER(634) )+!!((x)&MASK_Z ERO_IF_OVER(635 ))\
+!!((x)&MASK_ZE RO_IF_OVER(636) )+!!((x)&MASK_Z ERO_IF_OVER(637 ))\
+!!((x)&MASK_ZE RO_IF_OVER(638) )+!!((x)&MASK_Z ERO_IF_OVER(639 ))\
+!!((x)&MASK_ZE RO_IF_OVER(640) )+!!((x)&MASK_Z ERO_IF_OVER(641 ))\
+!!((x)&MASK_ZE RO_IF_OVER(642) )+!!((x)&MASK_Z ERO_IF_OVER(643 ))\
+!!((x)&MASK_ZE RO_IF_OVER(644) )+!!((x)&MASK_Z ERO_IF_OVER(645 ))\
+!!((x)&MASK_ZE RO_IF_OVER(646) )+!!((x)&MASK_Z ERO_IF_OVER(647 ))\
+!!((x)&MASK_ZE RO_IF_OVER(648) )+!!((x)&MASK_Z ERO_IF_OVER(649 ))\
+!!((x)&MASK_ZE RO_IF_OVER(650) )+!!((x)&MASK_Z ERO_IF_OVER(651 ))\
+!!((x)&MASK_ZE RO_IF_OVER(652) )+!!((x)&MASK_Z ERO_IF_OVER(653 ))\
+!!((x)&MASK_ZE RO_IF_OVER(654) )+!!((x)&MASK_Z ERO_IF_OVER(655 ))\
+!!((x)&MASK_ZE RO_IF_OVER(656) )+!!((x)&MASK_Z ERO_IF_OVER(657 ))\
+!!((x)&MASK_ZE RO_IF_OVER(658) )+!!((x)&MASK_Z ERO_IF_OVER(659 ))\
+!!((x)&MASK_ZE RO_IF_OVER(660) )+!!((x)&MASK_Z ERO_IF_OVER(661 ))\
+!!((x)&MASK_ZE RO_IF_OVER(662) )+!!((x)&MASK_Z ERO_IF_OVER(663 ))\
+!!((x)&MASK_ZE RO_IF_OVER(664) )+!!((x)&MASK_Z ERO_IF_OVER(665 ))\
+!!((x)&MASK_ZE RO_IF_OVER(666) )+!!((x)&MASK_Z ERO_IF_OVER(667 ))\
+!!((x)&MASK_ZE RO_IF_OVER(668) )+!!((x)&MASK_Z ERO_IF_OVER(669 ))\
+!!((x)&MASK_ZE RO_IF_OVER(670) )+!!((x)&MASK_Z ERO_IF_OVER(671 ))\
+!!((x)&MASK_ZE RO_IF_OVER(672) )+!!((x)&MASK_Z ERO_IF_OVER(673 ))\
+!!((x)&MASK_ZE RO_IF_OVER(674) )+!!((x)&MASK_Z ERO_IF_OVER(675 ))\
+!!((x)&MASK_ZE RO_IF_OVER(676) )+!!((x)&MASK_Z ERO_IF_OVER(677 ))\
+!!((x)&MASK_ZE RO_IF_OVER(678) )+!!((x)&MASK_Z ERO_IF_OVER(679 ))\
+!!((x)&MASK_ZE RO_IF_OVER(680) )+!!((x)&MASK_Z ERO_IF_OVER(681 ))\
+!!((x)&MASK_ZE RO_IF_OVER(682) )+!!((x)&MASK_Z ERO_IF_OVER(683 ))\
+!!((x)&MASK_ZE RO_IF_OVER(684) )+!!((x)&MASK_Z ERO_IF_OVER(685 ))\
+!!((x)&MASK_ZE RO_IF_OVER(686) )+!!((x)&MASK_Z ERO_IF_OVER(687 ))\
+!!((x)&MASK_ZE RO_IF_OVER(688) )+!!((x)&MASK_Z ERO_IF_OVER(689 ))\
+!!((x)&MASK_ZE RO_IF_OVER(690) )+!!((x)&MASK_Z ERO_IF_OVER(691 ))\
+!!((x)&MASK_ZE RO_IF_OVER(692) )+!!((x)&MASK_Z ERO_IF_OVER(693 ))\
+!!((x)&MASK_ZE RO_IF_OVER(694) )+!!((x)&MASK_Z ERO_IF_OVER(695 ))\
+!!((x)&MASK_ZE RO_IF_OVER(696) )+!!((x)&MASK_Z ERO_IF_OVER(697 ))\
+!!((x)&MASK_ZE RO_IF_OVER(698) )+!!((x)&MASK_Z ERO_IF_OVER(699 ))\
+!!((x)&MASK_ZE RO_IF_OVER(700) )+!!((x)&MASK_Z ERO_IF_OVER(701 ))\
+!!((x)&MASK_ZE RO_IF_OVER(702) )+!!((x)&MASK_Z ERO_IF_OVER(703 ))\
+!!((x)&MASK_ZE RO_IF_OVER(704) )+!!((x)&MASK_Z ERO_IF_OVER(705 ))\
+!!((x)&MASK_ZE RO_IF_OVER(706) )+!!((x)&MASK_Z ERO_IF_OVER(707 ))\
+!!((x)&MASK_ZE RO_IF_OVER(708) )+!!((x)&MASK_Z ERO_IF_OVER(709 ))\
+!!((x)&MASK_ZE RO_IF_OVER(710) )+!!((x)&MASK_Z ERO_IF_OVER(711 ))\
+!!((x)&MASK_ZE RO_IF_OVER(712) )+!!((x)&MASK_Z ERO_IF_OVER(713 ))\
+!!((x)&MASK_ZE RO_IF_OVER(714) )+!!((x)&MASK_Z ERO_IF_OVER(715 ))\
+!!((x)&MASK_ZE RO_IF_OVER(716) )+!!((x)&MASK_Z ERO_IF_OVER(717 ))\
+!!((x)&MASK_ZE RO_IF_OVER(718) )+!!((x)&MASK_Z ERO_IF_OVER(719 ))\
+!!((x)&MASK_ZE RO_IF_OVER(720) )+!!((x)&MASK_Z ERO_IF_OVER(721 ))\
+!!((x)&MASK_ZE RO_IF_OVER(722) )+!!((x)&MASK_Z ERO_IF_OVER(723 ))\
+!!((x)&MASK_ZE RO_IF_OVER(724) )+!!((x)&MASK_Z ERO_IF_OVER(725 ))\
+!!((x)&MASK_ZE RO_IF_OVER(726) )+!!((x)&MASK_Z ERO_IF_OVER(727 ))\
+!!((x)&MASK_ZE RO_IF_OVER(728) )+!!((x)&MASK_Z ERO_IF_OVER(729 ))\
+!!((x)&MASK_ZE RO_IF_OVER(730) )+!!((x)&MASK_Z ERO_IF_OVER(731 ))\
+!!((x)&MASK_ZE RO_IF_OVER(732) )+!!((x)&MASK_Z ERO_IF_OVER(733 ))\
+!!((x)&MASK_ZE RO_IF_OVER(734) )+!!((x)&MASK_Z ERO_IF_OVER(735 ))\
+!!((x)&MASK_ZE RO_IF_OVER(736) )+!!((x)&MASK_Z ERO_IF_OVER(737 ))\
+!!((x)&MASK_ZE RO_IF_OVER(738) )+!!((x)&MASK_Z ERO_IF_OVER(739 ))\
+!!((x)&MASK_ZE RO_IF_OVER(740) )+!!((x)&MASK_Z ERO_IF_OVER(741 ))\
+!!((x)&MASK_ZE RO_IF_OVER(742) )+!!((x)&MASK_Z ERO_IF_OVER(743 ))\
+!!((x)&MASK_ZE RO_IF_OVER(744) )+!!((x)&MASK_Z ERO_IF_OVER(745 ))\
+!!((x)&MASK_ZE RO_IF_OVER(746) )+!!((x)&MASK_Z ERO_IF_OVER(747 ))\
+!!((x)&MASK_ZE RO_IF_OVER(748) )+!!((x)&MASK_Z ERO_IF_OVER(749 ))\
+!!((x)&MASK_ZE RO_IF_OVER(750) )+!!((x)&MASK_Z ERO_IF_OVER(751 ))\
+!!((x)&MASK_ZE RO_IF_OVER(752) )+!!((x)&MASK_Z ERO_IF_OVER(753 ))\
+!!((x)&MASK_ZE RO_IF_OVER(754) )+!!((x)&MASK_Z ERO_IF_OVER(755 ))\
+!!((x)&MASK_ZE RO_IF_OVER(756) )+!!((x)&MASK_Z ERO_IF_OVER(757 ))\
+!!((x)&MASK_ZE RO_IF_OVER(758) )+!!((x)&MASK_Z ERO_IF_OVER(759 ))\
+!!((x)&MASK_ZE RO_IF_OVER(760) )+!!((x)&MASK_Z ERO_IF_OVER(761 ))\
+!!((x)&MASK_ZE RO_IF_OVER(762) )+!!((x)&MASK_Z ERO_IF_OVER(763 ))\
+!!((x)&MASK_ZE RO_IF_OVER(764) )+!!((x)&MASK_Z ERO_IF_OVER(765 ))\
+!!((x)&MASK_ZE RO_IF_OVER(766) )+!!((x)&MASK_Z ERO_IF_OVER(767 ))\
+!!((x)&MASK_ZE RO_IF_OVER(768) )+!!((x)&MASK_Z ERO_IF_OVER(769 ))\
+!!((x)&MASK_ZE RO_IF_OVER(770) )+!!((x)&MASK_Z ERO_IF_OVER(771 ))\
+!!((x)&MASK_ZE RO_IF_OVER(772) )+!!((x)&MASK_Z ERO_IF_OVER(773 ))\
+!!((x)&MASK_ZE RO_IF_OVER(774) )+!!((x)&MASK_Z ERO_IF_OVER(775 ))\
+!!((x)&MASK_ZE RO_IF_OVER(776) )+!!((x)&MASK_Z ERO_IF_OVER(777 ))\
+!!((x)&MASK_ZE RO_IF_OVER(778) )+!!((x)&MASK_Z ERO_IF_OVER(779 ))\
+!!((x)&MASK_ZE RO_IF_OVER(780) )+!!((x)&MASK_Z ERO_IF_OVER(781 ))\
+!!((x)&MASK_ZE RO_IF_OVER(782) )+!!((x)&MASK_Z ERO_IF_OVER(783 ))\
+!!((x)&MASK_ZE RO_IF_OVER(784) )+!!((x)&MASK_Z ERO_IF_OVER(785 ))\
+!!((x)&MASK_ZE RO_IF_OVER(786) )+!!((x)&MASK_Z ERO_IF_OVER(787 ))\
+!!((x)&MASK_ZE RO_IF_OVER(788) )+!!((x)&MASK_Z ERO_IF_OVER(789 ))\
+!!((x)&MASK_ZE RO_IF_OVER(790) )+!!((x)&MASK_Z ERO_IF_OVER(791 ))\
+!!((x)&MASK_ZE RO_IF_OVER(792) )+!!((x)&MASK_Z ERO_IF_OVER(793 ))\
+!!((x)&MASK_ZE RO_IF_OVER(794) )+!!((x)&MASK_Z ERO_IF_OVER(795 ))\
+!!((x)&MASK_ZE RO_IF_OVER(796) )+!!((x)&MASK_Z ERO_IF_OVER(797 ))\
+!!((x)&MASK_ZE RO_IF_OVER(798) )+!!((x)&MASK_Z ERO_IF_OVER(799 ))\
+!!((x)&MASK_ZE RO_IF_OVER(800) )+!!((x)&MASK_Z ERO_IF_OVER(801 ))\
+!!((x)&MASK_ZE RO_IF_OVER(802) )+!!((x)&MASK_Z ERO_IF_OVER(803 ))\
+!!((x)&MASK_ZE RO_IF_OVER(804) )+!!((x)&MASK_Z ERO_IF_OVER(805 ))\
+!!((x)&MASK_ZE RO_IF_OVER(806) )+!!((x)&MASK_Z ERO_IF_OVER(807 ))\
+!!((x)&MASK_ZE RO_IF_OVER(808) )+!!((x)&MASK_Z ERO_IF_OVER(809 ))\
+!!((x)&MASK_ZE RO_IF_OVER(810) )+!!((x)&MASK_Z ERO_IF_OVER(811 ))\
+!!((x)&MASK_ZE RO_IF_OVER(812) )+!!((x)&MASK_Z ERO_IF_OVER(813 ))\
+!!((x)&MASK_ZE RO_IF_OVER(814) )+!!((x)&MASK_Z ERO_IF_OVER(815 ))\
+!!((x)&MASK_ZE RO_IF_OVER(816) )+!!((x)&MASK_Z ERO_IF_OVER(817 ))\
+!!((x)&MASK_ZE RO_IF_OVER(818) )+!!((x)&MASK_Z ERO_IF_OVER(819 ))\
+!!((x)&MASK_ZE RO_IF_OVER(820) )+!!((x)&MASK_Z ERO_IF_OVER(821 ))\
+!!((x)&MASK_ZE RO_IF_OVER(822) )+!!((x)&MASK_Z ERO_IF_OVER(823 ))\
+!!((x)&MASK_ZE RO_IF_OVER(824) )+!!((x)&MASK_Z ERO_IF_OVER(825 ))\
+!!((x)&MASK_ZE RO_IF_OVER(826) )+!!((x)&MASK_Z ERO_IF_OVER(827 ))\
+!!((x)&MASK_ZE RO_IF_OVER(828) )+!!((x)&MASK_Z ERO_IF_OVER(829 ))\
+!!((x)&MASK_ZE RO_IF_OVER(830) )+!!((x)&MASK_Z ERO_IF_OVER(831 ))\
+!!((x)&MASK_ZE RO_IF_OVER(832) )+!!((x)&MASK_Z ERO_IF_OVER(833 ))\
+!!((x)&MASK_ZE RO_IF_OVER(834) )+!!((x)&MASK_Z ERO_IF_OVER(835 ))\
+!!((x)&MASK_ZE RO_IF_OVER(836) )+!!((x)&MASK_Z ERO_IF_OVER(837 ))\
+!!((x)&MASK_ZE RO_IF_OVER(838) )+!!((x)&MASK_Z ERO_IF_OVER(839 ))\
+!!((x)&MASK_ZE RO_IF_OVER(840) )+!!((x)&MASK_Z ERO_IF_OVER(841 ))\
+!!((x)&MASK_ZE RO_IF_OVER(842) )+!!((x)&MASK_Z ERO_IF_OVER(843 ))\
+!!((x)&MASK_ZE RO_IF_OVER(844) )+!!((x)&MASK_Z ERO_IF_OVER(845 ))\
+!!((x)&MASK_ZE RO_IF_OVER(846) )+!!((x)&MASK_Z ERO_IF_OVER(847 ))\
+!!((x)&MASK_ZE RO_IF_OVER(848) )+!!((x)&MASK_Z ERO_IF_OVER(849 ))\
+!!((x)&MASK_ZE RO_IF_OVER(850) )+!!((x)&MASK_Z ERO_IF_OVER(851 ))\
+!!((x)&MASK_ZE RO_IF_OVER(852) )+!!((x)&MASK_Z ERO_IF_OVER(853 ))\
+!!((x)&MASK_ZE RO_IF_OVER(854) )+!!((x)&MASK_Z ERO_IF_OVER(855 ))\
+!!((x)&MASK_ZE RO_IF_OVER(856) )+!!((x)&MASK_Z ERO_IF_OVER(857 ))\
+!!((x)&MASK_ZE RO_IF_OVER(858) )+!!((x)&MASK_Z ERO_IF_OVER(859 ))\
+!!((x)&MASK_ZE RO_IF_OVER(860) )+!!((x)&MASK_Z ERO_IF_OVER(861 ))\
+!!((x)&MASK_ZE RO_IF_OVER(862) )+!!((x)&MASK_Z ERO_IF_OVER(863 ))\
+!!((x)&MASK_ZE RO_IF_OVER(864) )+!!((x)&MASK_Z ERO_IF_OVER(865 ))\
+!!((x)&MASK_ZE RO_IF_OVER(866) )+!!((x)&MASK_Z ERO_IF_OVER(867 ))\
+!!((x)&MASK_ZE RO_IF_OVER(868) )+!!((x)&MASK_Z ERO_IF_OVER(869 ))\
+!!((x)&MASK_ZE RO_IF_OVER(870) )+!!((x)&MASK_Z ERO_IF_OVER(871 ))\
+!!((x)&MASK_ZE RO_IF_OVER(872) )+!!((x)&MASK_Z ERO_IF_OVER(873 ))\
+!!((x)&MASK_ZE RO_IF_OVER(874) )+!!((x)&MASK_Z ERO_IF_OVER(875 ))\
+!!((x)&MASK_ZE RO_IF_OVER(876) )+!!((x)&MASK_Z ERO_IF_OVER(877 ))\
+!!((x)&MASK_ZE RO_IF_OVER(878) )+!!((x)&MASK_Z ERO_IF_OVER(879 ))\
+!!((x)&MASK_ZE RO_IF_OVER(880) )+!!((x)&MASK_Z ERO_IF_OVER(881 ))\
+!!((x)&MASK_ZE RO_IF_OVER(882) )+!!((x)&MASK_Z ERO_IF_OVER(883 ))\
+!!((x)&MASK_ZE RO_IF_OVER(884) )+!!((x)&MASK_Z ERO_IF_OVER(885 ))\
+!!((x)&MASK_ZE RO_IF_OVER(886) )+!!((x)&MASK_Z ERO_IF_OVER(887 ))\
+!!((x)&MASK_ZE RO_IF_OVER(888) )+!!((x)&MASK_Z ERO_IF_OVER(889 ))\
+!!((x)&MASK_ZE RO_IF_OVER(890) )+!!((x)&MASK_Z ERO_IF_OVER(891 ))\
+!!((x)&MASK_ZE RO_IF_OVER(892) )+!!((x)&MASK_Z ERO_IF_OVER(893 ))\
+!!((x)&MASK_ZE RO_IF_OVER(894) )+!!((x)&MASK_Z ERO_IF_OVER(895 ))\
+!!((x)&MASK_ZE RO_IF_OVER(896) )+!!((x)&MASK_Z ERO_IF_OVER(897 ))\
+!!((x)&MASK_ZE RO_IF_OVER(898) )+!!((x)&MASK_Z ERO_IF_OVER(899 ))\
+!!((x)&MASK_ZE RO_IF_OVER(900) )+!!((x)&MASK_Z ERO_IF_OVER(901 ))\
+!!((x)&MASK_ZE RO_IF_OVER(902) )+!!((x)&MASK_Z ERO_IF_OVER(903 ))\
+!!((x)&MASK_ZE RO_IF_OVER(904) )+!!((x)&MASK_Z ERO_IF_OVER(905 ))\
+!!((x)&MASK_ZE RO_IF_OVER(906) )+!!((x)&MASK_Z ERO_IF_OVER(907 ))\
+!!((x)&MASK_ZE RO_IF_OVER(908) )+!!((x)&MASK_Z ERO_IF_OVER(909 ))\
+!!((x)&MASK_ZE RO_IF_OVER(910) )+!!((x)&MASK_Z ERO_IF_OVER(911 ))\
+!!((x)&MASK_ZE RO_IF_OVER(912) )+!!((x)&MASK_Z ERO_IF_OVER(913 ))\
+!!((x)&MASK_ZE RO_IF_OVER(914) )+!!((x)&MASK_Z ERO_IF_OVER(915 ))\
+!!((x)&MASK_ZE RO_IF_OVER(916) )+!!((x)&MASK_Z ERO_IF_OVER(917 ))\
+!!((x)&MASK_ZE RO_IF_OVER(918) )+!!((x)&MASK_Z ERO_IF_OVER(919 ))\
+!!((x)&MASK_ZE RO_IF_OVER(920) )+!!((x)&MASK_Z ERO_IF_OVER(921 ))\
+!!((x)&MASK_ZE RO_IF_OVER(922) )+!!((x)&MASK_Z ERO_IF_OVER(923 ))\
+!!((x)&MASK_ZE RO_IF_OVER(924) )+!!((x)&MASK_Z ERO_IF_OVER(925 ))\
+!!((x)&MASK_ZE RO_IF_OVER(926) )+!!((x)&MASK_Z ERO_IF_OVER(927 ))\
+!!((x)&MASK_ZE RO_IF_OVER(928) )+!!((x)&MASK_Z ERO_IF_OVER(929 ))\
+!!((x)&MASK_ZE RO_IF_OVER(930) )+!!((x)&MASK_Z ERO_IF_OVER(931 ))\
+!!((x)&MASK_ZE RO_IF_OVER(932) )+!!((x)&MASK_Z ERO_IF_OVER(933 ))\
+!!((x)&MASK_ZE RO_IF_OVER(934) )+!!((x)&MASK_Z ERO_IF_OVER(935 ))\
+!!((x)&MASK_ZE RO_IF_OVER(936) )+!!((x)&MASK_Z ERO_IF_OVER(937 ))\
+!!((x)&MASK_ZE RO_IF_OVER(938) )+!!((x)&MASK_Z ERO_IF_OVER(939 ))\
+!!((x)&MASK_ZE RO_IF_OVER(940) )+!!((x)&MASK_Z ERO_IF_OVER(941 ))\
+!!((x)&MASK_ZE RO_IF_OVER(942) )+!!((x)&MASK_Z ERO_IF_OVER(943 ))\
+!!((x)&MASK_ZE RO_IF_OVER(944) )+!!((x)&MASK_Z ERO_IF_OVER(945 ))\
+!!((x)&MASK_ZE RO_IF_OVER(946) )+!!((x)&MASK_Z ERO_IF_OVER(947 ))\
+!!((x)&MASK_ZE RO_IF_OVER(948) )+!!((x)&MASK_Z ERO_IF_OVER(949 ))\
+!!((x)&MASK_ZE RO_IF_OVER(950) )+!!((x)&MASK_Z ERO_IF_OVER(951 ))\
+!!((x)&MASK_ZE RO_IF_OVER(952) )+!!((x)&MASK_Z ERO_IF_OVER(953 ))\
+!!((x)&MASK_ZE RO_IF_OVER(954) )+!!((x)&MASK_Z ERO_IF_OVER(955 ))\
+!!((x)&MASK_ZE RO_IF_OVER(956) )+!!((x)&MASK_Z ERO_IF_OVER(957 ))\
+!!((x)&MASK_ZE RO_IF_OVER(958) )+!!((x)&MASK_Z ERO_IF_OVER(959 ))\
+!!((x)&MASK_ZE RO_IF_OVER(960) )+!!((x)&MASK_Z ERO_IF_OVER(961 ))\
+!!((x)&MASK_ZE RO_IF_OVER(962) )+!!((x)&MASK_Z ERO_IF_OVER(963 ))\
+!!((x)&MASK_ZE RO_IF_OVER(964) )+!!((x)&MASK_Z ERO_IF_OVER(965 ))\
+!!((x)&MASK_ZE RO_IF_OVER(966) )+!!((x)&MASK_Z ERO_IF_OVER(967 ))\
+!!((x)&MASK_ZE RO_IF_OVER(968) )+!!((x)&MASK_Z ERO_IF_OVER(969 ))\
+!!((x)&MASK_ZE RO_IF_OVER(970) )+!!((x)&MASK_Z ERO_IF_OVER(971 ))\
+!!((x)&MASK_ZE RO_IF_OVER(972) )+!!((x)&MASK_Z ERO_IF_OVER(973 ))\
+!!((x)&MASK_ZE RO_IF_OVER(974) )+!!((x)&MASK_Z ERO_IF_OVER(975 ))\
+!!((x)&MASK_ZE RO_IF_OVER(976) )+!!((x)&MASK_Z ERO_IF_OVER(977 ))\
+!!((x)&MASK_ZE RO_IF_OVER(978) )+!!((x)&MASK_Z ERO_IF_OVER(979 ))\
+!!((x)&MASK_ZE RO_IF_OVER(980) )+!!((x)&MASK_Z ERO_IF_OVER(981 ))\
+!!((x)&MASK_ZE RO_IF_OVER(982) )+!!((x)&MASK_Z ERO_IF_OVER(983 ))\
+!!((x)&MASK_ZE RO_IF_OVER(984) )+!!((x)&MASK_Z ERO_IF_OVER(985 ))\
+!!((x)&MASK_ZE RO_IF_OVER(986) )+!!((x)&MASK_Z ERO_IF_OVER(987 ))\
+!!((x)&MASK_ZE RO_IF_OVER(988) )+!!((x)&MASK_Z ERO_IF_OVER(989 ))\
+!!((x)&MASK_ZE RO_IF_OVER(990) )+!!((x)&MASK_Z ERO_IF_OVER(991 ))\
+!!((x)&MASK_ZE RO_IF_OVER(992) )+!!((x)&MASK_Z ERO_IF_OVER(993 ))\
+!!((x)&MASK_ZE RO_IF_OVER(994) )+!!((x)&MASK_Z ERO_IF_OVER(995 ))\
+!!((x)&MASK_ZE RO_IF_OVER(996) )+!!((x)&MASK_Z ERO_IF_OVER(997 ))\
+!!((x)&MASK_ZE RO_IF_OVER(998) )+!!((x)&MASK_Z ERO_IF_OVER(999 ))\
+!!((x)&MASK_ZE RO_IF_OVER(1000 ))+!!((x)&MASK_ ZERO_IF_OVER(10 01))\
+!!((x)&MASK_ZE RO_IF_OVER(1002 ))+!!((x)&MASK_ ZERO_IF_OVER(10 03))\
+!!((x)&MASK_ZE RO_IF_OVER(1004 ))+!!((x)&MASK_ ZERO_IF_OVER(10 05))\
+!!((x)&MASK_ZE RO_IF_OVER(1006 ))+!!((x)&MASK_ ZERO_IF_OVER(10 07))\
+!!((x)&MASK_ZE RO_IF_OVER(1008 ))+!!((x)&MASK_ ZERO_IF_OVER(10 09))\
+!!((x)&MASK_ZE RO_IF_OVER(1010 ))+!!((x)&MASK_ ZERO_IF_OVER(10 11))\
+!!((x)&MASK_ZE RO_IF_OVER(1012 ))+!!((x)&MASK_ ZERO_IF_OVER(10 13))\
+!!((x)&MASK_ZE RO_IF_OVER(1014 ))+!!((x)&MASK_ ZERO_IF_OVER(10 15))\
+!!((x)&MASK_ZE RO_IF_OVER(1016 ))+!!((x)&MASK_ ZERO_IF_OVER(10 17))\
+!!((x)&MASK_ZE RO_IF_OVER(1018 ))+!!((x)&MASK_ ZERO_IF_OVER(10 19))\
+!!((x)&MASK_ZE RO_IF_OVER(1020 ))+!!((x)&MASK_ ZERO_IF_OVER(10 21))\
+!!((x)&MASK_ZE RO_IF_OVER(1022 ))+!!((x)&MASK_ ZERO_IF_OVER(10 23)))

#define QUANT_BITS_SET( x) QUANT_BITS_SET_ RAW( ((BitsSetType)( x)) )

#include <stdio.h>

int main(void)
{
/* Let's make an array of length 4 */

int arr[QUANT_BITS_SET( 17)];

printf("%u",(un signed)(sizeof arr/sizeof*arr));
}

The codes prints 2 on my system, but you get the idea...

--

Frederick Gotham
Sep 13 '06 #18
Frederick Gotham wrote:
Richard Heathfield posted:
>Your solution doesn't appear to cope with integers wider than 21 bits,
for a start. Secondly, it doesn't cope with integers that are /fewer/
than 21 bits wide! Thirdly, it could conceivably be counting "padding
bits", bits that do not contribute to the value of the integer.
<snip>
>"If the value of the right operand is negative or is greater
than or equal to the width in bits of the promoted left operand, the
behavior is undefined."


I meant something more along the following lines. Do compilers nowadays
optimise away Bitwise-AND operations when one of the operands is known to
be 0 at compile-time?
Yes. Constant folding is somethings almost all compilers handle well. (Those
that don't are usually too hopeless to consider for optmizing purposes.)
Take care that the compiler still has to parse the entire expression; some
low-end systems may barf on such enormous constructs.
/* Macro: QUANT_BITS_SET

This macro determines the quantity of bits which
are set in an integer expression whose signedness
is unsigned.
I prefer my desktop calculator, but YMMV.

<snip>
/* Let's make an array of length 4 */
A misleading comment if ever I saw one.
int arr[QUANT_BITS_SET( 17)];
Hmm, I'd write that

#define BITS_SET_IN_THE _BINARY_REPRESE NTATION_OF_17 2
[...]
int arr[BITS_SET_IN_THE _BINARY_REPRESE NTATION_OF_17]

Still uses a rather unwieldy macro, but it's a tad shorter nonetheless.
printf("%u",(un signed)(sizeof arr/sizeof*arr));
}

The codes prints 2 on my system, but you get the idea...
Yes, the preprocessor is neat.

S.
Sep 14 '06 #19
Skarmander posted:
Constant folding is somethings almost all compilers handle well. (Those
that don't are usually too hopeless to consider for optmizing
purposes.)

We could always write more macros which use the ternary operator to get rid
of redundant Bitwise-AND operations. Something like:

#define BitwiseAND(x,ma sk) (\
(mask) \
? x & (mask) \
: 0 )

And we could even go further to strip out the additions:

#define Add(a,b) (\
(b) \
? (a) + (b) \
: (a) )

> /* Let's make an array of length 4 */
A misleading comment if ever I saw one.

Don't ask me how, but I somehow calculated that 17 had four bits set.

--

Frederick Gotham
Sep 14 '06 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
2795
by: Danny Anderson | last post by:
Hola! I have an array of shorts that represents a stream of data. This data is packed in tight, so certain elements may actually contain data for more than one variable. I am to decipher this stream. The first variable packed into this array happens to be a short, meaning I get away with a simple assignment: myFirstVariable=myArray;
6
3501
by: cylin | last post by:
Hi all, If I have a variable and it's just have 22 bits, and I must set this variable unsigned integer. This 2's complement value maybe is negative. For example: A= 11 1111 1111 1110 1100 0000 = 4193984 3 f f e c 0 A's 2's complement should be
9
8793
by: GGG | last post by:
Noticed something odd in the way bit shifting was working today. As far as I have ever heard, shifting will shift in zeros(signed ints aside) However I foudn something odd when I am shifting exactly the number of bits in a value... i.e. uint32_t x = 5;
26
8259
by: G Patel | last post by:
Hi, I'm wondering if anyone knows if the following function will function properly as a set-bit counter on non 2s complement machines (as K&R2 implies). | int bitcount(unsigned x) | { | int count; | | for(count = 0; x != 0; count++, x &= (x-1)) | ;
14
2605
by: vib | last post by:
Hi there, union UC32 { unsigned int L; unsigned short S; unsigned char C; } UC32; with the above structure, I am able to shift bits of C, into C, and C into C so on and so forth till C as they are "union"ed
36
5343
by: Digital Puer | last post by:
Hi, suppose I have an unsigned long long. I would like to extract the front 'n' bits of this value and convert them into an integer. For example, if I extract the first 3 bits, I would get an int between 0 and 7 (=2^3-1). Could someone please help out? I can assume the largest returned value fits in an int. Also, I'm on a big-endian PPC (AIX), in case that matters. Ideally, I'd like to implement a prototype like: int...
64
3974
by: yossi.kreinin | last post by:
Hi! There is a system where 0x0 is a valid address, but 0xffffffff isn't. How can null pointers be treated by a compiler (besides the typical "solution" of still using 0x0 for "null")? - AFAIK C allows "null pointers" to be represented differently then "all bits 0". Is this correct? - AFAIK I can't `#define NULL 0x10000' since `void* p=0;' should work just like `void* p=NULL'. Is this correct?
40
36526
by: KG | last post by:
Could any one tell me how to reverse the bits in an interger?
6
2855
by: John Messenger | last post by:
I notice that the C standard allows padding bits in both unsigned and signed integer types. Does anyone know of any real-world examples of compilers that use padding bits? -- John
0
9845
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11277
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10978
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10497
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9672
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7204
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5892
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4724
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4305
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.