Jump to content

Find first and last set bit of a long integer: Difference between revisions

m
Line 609:
Even though Fortran has intrinsic functions, and modern machines have special instructions for the task, it still seems worthwhile to write out functions.
 
One thing that is evident, if you study the various ways to implement these functions, is that Fortran is ill suited, in a way most high-level languages have been ill- suited since the beginning of time: they do not have built in ''unsigned'' integers ''with ''overflow explicitly allowed''. ISO standard C does (and thus so does ATS, because its integers are exactly C integers). But this is unusual, outside of C and its relatives, and (I would imagine) owes to C's origins as a replacement for assembly language.
 
<lang fortran>! As was already pointed out, Fortran already has intrinsic functions that
! that should compile to efficient code, such as a single machine
! instruction. But it seems profitable to have written implementations
! according to the full task description, and also by other methods.
1,448

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.