[so] [Tema1] Clarificare enunt

Alexandru Elisei alexandru.elisei at gmail.com
Wed Mar 8 12:25:24 EET 2017


Din enunt: "Lungimea hash-ului și a unui cuvânt vor fi reprezentate pe
un număr pe *32 de biți (fără semn).*"

Din declaratia functiei de hash [1]:
unsigned int hash(const char *str, unsigned int hash_length);

Din ISO C99, capitolul 5.2.4.2.1 Sizes of integer types:
"Their implementation-defined values shall be equal or greater in
magnitude (absolute value) to those shown, with the same sign.
[..]
— maximum value for an object of type unsigned int
UINT_MAX 65535 // 2^16 - 1"

Se depuncteaza daca nu folosim un fixed-width integer (ca uint32_t)
pentru dimensiunea hash-ului din moment ce functia de hash returneaza
un unsigned int?

[1] https://github.com/systems-cs-pub-ro/so-assignments/blob/master/1-multi/util/hash.h#L16


More information about the so mailing list