Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Without fixed size integers?
But that would mean the hash could be of arbitrary length. Wouldn't that go against the idea of hashing algorithms? -
Sounds like an X/Y problem, i.e. a question rooted in a wrong approach to the problem.
-
@Fast-Nop
@LotsOfCaffeine
Maybe I've written it wrong.
I want to implement it in C, without stdint.h (int64_t,...).
Just normal int,size_t...
My point is, that the size of those aren't guarantied by the API. -
@metamourge Reason?
Your compiler knows the sizes during compilation, and you can do check the sizes with #if.
stdint.h does exactly that, and creates appropriate typedefs matching the "sized" to correct "unsized" ones. -
@metamourge So it is an X/Y problem.
The fixed integer sizes are guaranteed by the standard from C99 onwards. There's absolutely no reason to not use them because you'd be hard pressed to find a C compiler without C99 datatype support.
And even if you should encounter one, you can add that header file yourself for the platform and compiler you're using because all these types actually do is encaptulating the varying int sizes via typedefs.
Do you know a hash-function (doesn't need to be cryptographic) that I can implement, without fixed size integer-types?
I already searched for a while, but couldn't find an actual fit.
It's for implementing a hasher, used by a hashmap.
question