lua-users home
lua-l archive

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


I'm sorry for the inconvenience caused to you.
I will do use "text only mode" right away .
but you look at the commits here
/*
** Hash for integers. To allow a good hash, use the remainder operator
** ('%'). If integer fits as a non-negative int, compute an int
** remainder, which is faster. Otherwise, use an unsigned-integer
** remainder, which uses all bits and ensures a non-negative result.
*/

The author seems to mean it if use the "cast_int(ui)"  compute an int
remainder, is faster


bil til <biltil52@gmail.com> 于2023年1月20日周五 22:55写道:
>
> I think this is due to a "possible pecularity of some C compilers",
> that if you do ui modulo (ui % ...), it somehow seems to be better to
> it separately for positive (0-0x7FFFF...) and negative
> (0x8000...-0xFFFF...) ints... . (but I also do not understand this
> COMPLETELY ... maybe some C compilers wold throw warnings or errors if
> you try to handle it in one command...).
>
> If this function hashint is VERY OFTEN invoked, it is really a bit
> strange that a comparison command is invested here. (I think this
> function hashint is perhaps NOT VERY often invoked, otherwise it might
> be also be programmed as macro, which would then typically be faster,
> as the comparison could be skipped perhaps by some "tricky
> pre-compiler programming").
>
> Could you try to instruct your mail program, to use "text only mode"
> if you post here in this mailing list - if you post HTML code, it is
> nearly unreadable e. g. in MARC (https://marc.info/?l=lua-l&r=1&w=2).