Szakáts Viktor wrote:
Hi Przemek,

I forgot about one thing, in order to implement
__i18n_gettext() with hashes, two hash lookups
are needed, but my tests were doing only one.

Is there a way to eliminate two hash lookups
in this expression:

// IN: text, hash
IF text $ hash
   text := hash[ text ]
ENDIF
// OUT: text

I'm thinking of something like hb_HGet(), but
to return the original key (or a passed default)
if it's not found in the hash table (instead of
generating an RTE).


Hi,


I see no problem here. It's simple to eliminate two lookups by using HB_HSCAN() and HB_HVALUEAT(), but this could not increase speed because of additional PCODE for function calls.

Implementation in C language by using hb_hashScan() and hb_hashGetValueAt() for sure will be best and will use a single hash lookup.


Best regards,
Mindaugas
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to