Repository navigation
Conversation
|
I raised this a while back: #3125 |
There was a problem hiding this comment.
sizeof(size_t) != sizeof(unsigned long long)
There was a problem hiding this comment.
I'm not convinced that making this always return unsigned long long is a good idea. Each CPU will have a native best size.
|
Trouble is that there is no common type suitable for all platforms. Well, there is one thing one can tell for sure, that return value is 64 bits in all 64-bit builds. Another thing one can tell is that if one tries to use One can also flip the question and aim for harmonization of all assembly implementations to return 64-bit value. Trouble is that not all processors can deliver that, in which cases single wraparound occurrences(*) will be broken. But one can as well choose disregard this. In other words no matter what one does there always is a corner case :-( To summarize, given subroutine's usage pattern and overall context is not really inappropriate to be a bit opportunistic and just settle for (*) one 32-bit wraparound works, because you ignore borrow anyway; |
|
Or we could define an internal type that represents the return value: I'd also consider a name change: rdtsc is very x86 specific. We not only use this as a timer but also as a low grade entropy source in the RNG infrastructure. |
|
I'm currently leaning towards just making it return an uint32_t. |
|
Another alternative is to simply omit all those #ifdef segments. They are really debugging artefacts, and they are meant to produce meaningful output only in specific and controlled conditions. I won't miss them (since I kept original copies which are more suitable for debugging purposes) and users are better off using openssl speed... |
Switch to make it return an uint32_t instead of the various different types it returns now. Fixes: openssl#3125
|
So I've pushed a new commit changing it to uint32_t. I just don't have an idea if the assembler versions still work properly. |
|
As already said, assembler is good up to size_t. |
This came out a little bit wrong. All assembly modules will work with return type declared up to size_t. [And some 32-bit ones would work with 64-bit return, some will fail...] |
|
It seems like |
|
Either way works [including removal of #ifdefs]. I'm giving it few day hours in case Kurt changes his mind, and then approving it. |
Switch to make it return an uint32_t instead of the various different types it returns now. Fixes: #3125 Reviewed-by: Andy Polyakov <[email protected]> GH: #4757
@dot-asm: Does this make sense?
I think so arches have it as long, other as long long.