A lot of CompilerIf statements can make the code harder to read.
I tried to use Macro's to make things easier.
Code: Select all
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
Macro _RegB : ebx : EndMacro
Macro _RegD : edx : EndMacro
CompilerElse
Macro _RegB : rbx : EndMacro
Macro _RegD : rdx : EndMacro
CompilerEndIf
Procedure.l FNV32a(*key, len.l)
EnableASM
MOV _RegD, *key
MOV ecx, len
PUSH _RegB
!mov eax, 2166136261
!fnv32a_loop:
MOVZX ebx, byte [_RegD]
!xor eax, ebx
!imul eax, 0x01000193
INC _RegD
!dec ecx
!jnz fnv32a_loop
POP _RegB
DisableASM
ProcedureReturn
EndProcedure