lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


hi! bil til
Thanks for your answer!
 but I want to know what is this place
  return hashmod(t, cast_int(ui));  //------------------------------------------      

 Why do you want to use `cast_int(ui)`
---- Replied Message ----
From bil til<biltil52@gmail.com>
Date 1/20/2023 22:00
To Lua mailing list<lua-l@lists.lua.org>
Subject Re: Why do you want to use“cast_int“ to force “ui” to int
such a cast typically does not produce code in assembler...

it is just an instruction for the compiler, to use the correct
comparison operator (in this case "unsigned <= unsigned").

If you would not do such casting, in "best case" you would get C
compiler warnings or errors - in worst case severe
"misunderstandings"... .