Closed redstar closed 6 years ago
@timotheecour Maybe you can extend your PR #116 ? Because all credits for this belongs to you.
@redstar @msoucy what's the advantage over original PR https://github.com/msoucy/dproto/pull/116 ? The unittest still fails with "sint64" , "sint32"
but you've omitted these cases (at least should document that these cases fail and how, as I was doing in orginal PR)
EDIT: I found how to fix the bug for "sint64" , "sint32"
; will update PR
@timotheecour This PR compiles with more DMD versions. Be sure to grab the __trait(compiles(...))
when you update your PR.
done, we can close this in favor of https://github.com/msoucy/dproto/pull/131 which also fixes the bug with "sint64" , "sint32"
Root cause of the problem is that the used base data type for reading an integer is always
ulong
. Converting a (huge) value to a signed, possible shorter data type results in the onversion exception.Solution is to use the correct type. This eliminates almost all calls to the
std.conv.to
function.All credits for the fix go to @timotheecour Timothee Cour as he found the problem and created the first solution.