dgy at DakotaCom.Net
Wed Apr 5 14:03:06 CDT 2006
Sean 'Captain Napalm' Conner wrote:
> It was thus said that the Great Don Y once stated:
>>> And I totally agree with your point about packing bits and loss of
>>> carry. The things I've done to get carry in C.
>> Particularly frustrating when dealing with multiple precision
>> arithmetic. You just *know* that if you were writing it in
>> ASM, the carry would be there "for free". Yet, you have
>> to add a separate step to deliberately synthesize it in C
>> (or, change the fundamental algorithm that you use -- which
>> just obfuscates that little detail)
>> Sort of like converting to decimal:
>> digit = value % 10;
>> value /= 10;
> C has the div() function, which returns both the quotient and remainder.
> Most modern compilers should inline this function.
Most modern compilers for "big" machines. The point I've been
making is that many machines aren't big and have hackish
compilers, at best. So, even if you code div() yourself,
(as many standard libraries with these hacky compilers are
equally hacky! -- implementing div() *as* the code
fragment I mentioned above!) there's no way of coaxing
the compiler to be smart enough to use it efficiently.
C isnt always C (you've got folks like ZWorld claiming to
"improve" it, etc.)
> But yes, I do miss having access to the carry bit, but the level of code
> I'm writing nowadays has made that less of an issue.
> -spc (Besides, there's the Gnu Multiprecision Math library, which has
> assembly support for a large number of architectures ... )
Again, *big* machines! :>
More information about the cctalk