##No check for end of array##
No check for end of array
incByte()
doesn't check if i >= 0
. So if all bytes are 0xff
, it will happily start reading/writing to state[-1]
.
##Simplification##
Simplification
Actually, I would remove the recursion. If byte
is of size 1 byte, you could also simplify the check for overflow past 0xff
:
void incByte(byte *state, int i)
{
do {
if (++state[i] != 0)
return;
i--;
} while (i >= 0);
}
##No check for end of array##
incByte()
doesn't check if i >= 0
. So if all bytes are 0xff
, it will happily start reading/writing to state[-1]
.
##Simplification##
Actually, I would remove the recursion. If byte
is of size 1 byte, you could also simplify the check for overflow past 0xff
:
void incByte(byte *state, int i)
{
do {
if (++state[i] != 0)
return;
i--;
} while (i >= 0);
}
No check for end of array
incByte()
doesn't check if i >= 0
. So if all bytes are 0xff
, it will happily start reading/writing to state[-1]
.
Simplification
Actually, I would remove the recursion. If byte
is of size 1 byte, you could also simplify the check for overflow past 0xff
:
void incByte(byte *state, int i)
{
do {
if (++state[i] != 0)
return;
i--;
} while (i >= 0);
}
##No check for end of array##
incByte()
doesn't check if i >= 0
. So if all bytes are 0xff
, it will happily start reading/writing to state[-1]
.
##Simplification##
Actually, I would remove the recursion. If byte
is of size 1 byte, you could also simplify the check for overflow past 0xff
:
void incByte(byte *state, int i)
{
while (i >= 0)do {
if (++state[i] != 0)
return;
i--;
} while (i >= 0);
}
##No check for end of array##
incByte()
doesn't check if i >= 0
. So if all bytes are 0xff
, it will happily start reading/writing to state[-1]
.
##Simplification##
Actually, I would remove the recursion. If byte
is of size 1 byte, you could also simplify the check for overflow past 0xff
:
void incByte(byte *state, int i)
{
while (i >= 0) {
if (++state[i] != 0)
return;
i--;
}
}
##No check for end of array##
incByte()
doesn't check if i >= 0
. So if all bytes are 0xff
, it will happily start reading/writing to state[-1]
.
##Simplification##
Actually, I would remove the recursion. If byte
is of size 1 byte, you could also simplify the check for overflow past 0xff
:
void incByte(byte *state, int i)
{
do {
if (++state[i] != 0)
return;
i--;
} while (i >= 0);
}
##No check for end of array##
incByte()
doesn't check if i >= 0
. So if all bytes are 0xff
, it will happily start reading/writing to state[-1]
.
##Simplification##
Actually, I would remove the recursion. Also if If byte
is of size 1 byte, you could also simplify the if statementcheck for overflow past 0xff
:
void incByte(byte *state, int i)
{
while (i >= 0) {
if (++state[i] != 0)
return;
i--;
}
}
##No check for end of array##
incByte()
doesn't check if i >= 0
. So if all bytes are 0xff
, it will happily start reading/writing to state[-1]
.
##Simplification##
Actually, I would remove the recursion. Also if byte
is of size 1 byte, you could also simplify the if statement:
void incByte(byte *state, int i)
{
while (i >= 0) {
if (++state[i] != 0)
return;
i--;
}
}
##No check for end of array##
incByte()
doesn't check if i >= 0
. So if all bytes are 0xff
, it will happily start reading/writing to state[-1]
.
##Simplification##
Actually, I would remove the recursion. If byte
is of size 1 byte, you could also simplify the check for overflow past 0xff
:
void incByte(byte *state, int i)
{
while (i >= 0) {
if (++state[i] != 0)
return;
i--;
}
}