S
Serve Laurijssen
I've been working on an old 8-bit system and came across a problem with the
<< operator
This would always yield 0:
unsigned char i;
for (i = 0; i < 4; i++)
{
unsigned char idx = 1 << i;
....
}
while this worked as expected:
unsigned char i, mask = 1;
for (i = 0; i < 4; i++)
{
unsigned char idx = mask;
....
mask = mask << 1;
}
Is there something wrong with the first version considering that this is
code for an 8-bitter?
<< operator
This would always yield 0:
unsigned char i;
for (i = 0; i < 4; i++)
{
unsigned char idx = 1 << i;
....
}
while this worked as expected:
unsigned char i, mask = 1;
for (i = 0; i < 4; i++)
{
unsigned char idx = mask;
....
mask = mask << 1;
}
Is there something wrong with the first version considering that this is
code for an 8-bitter?