mirror of
https://github.com/wownero/RandomX.git
synced 2026-10-20 16:58:46 +02:00
Refactoring (#95)
* Blake2Generator::getInt32 renamed to getUInt32 to avoid confusion * isPowerOf2 renamed to isZeroOrPowerOf2 to avoid confusion * added asserts to validate the input/output size of AES functions * fixed possible overflow in JitCompilerX86::getCodeSize (unused function)
This commit is contained in:
@@ -197,7 +197,7 @@ namespace randomx {
|
||||
static const uint8_t* NOPX[] = { NOP1, NOP2, NOP3, NOP4, NOP5, NOP6, NOP7, NOP8 };
|
||||
|
||||
size_t JitCompilerX86::getCodeSize() {
|
||||
return codePos - prologueSize;
|
||||
return codePos < prologueSize ? 0 : codePos - prologueSize;
|
||||
}
|
||||
|
||||
JitCompilerX86::JitCompilerX86() {
|
||||
@@ -580,7 +580,7 @@ namespace randomx {
|
||||
|
||||
void JitCompilerX86::h_IMUL_RCP(Instruction& instr, int i) {
|
||||
uint64_t divisor = instr.getImm32();
|
||||
if (!isPowerOf2(divisor)) {
|
||||
if (!isZeroOrPowerOf2(divisor)) {
|
||||
registerUsage[instr.dst] = i;
|
||||
emit(MOV_RAX_I);
|
||||
emit64(randomx_reciprocal_fast(divisor));
|
||||
|
||||
Reference in New Issue
Block a user