ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libecb/ecb.pod
(Generate patch)

Comparing libecb/ecb.pod (file contents):
Revision 1.24 by root, Tue May 31 21:10:37 2011 UTC vs.
Revision 1.25 by root, Tue May 31 21:52:31 2011 UTC

432 432
433=over 4 433=over 4
434 434
435=item x = ecb_mod (m, n) 435=item x = ecb_mod (m, n)
436 436
437Returns the positive remainder of the modulo operation between C<m> and 437Returns C<m> modulo C<n>, which is the same as the positive remainder
438C<n>, using floored division. Unlike the C modulo operator C<%>, this 438of the division operation between C<m> and C<n>, using floored
439function ensures that the return value is always positive and that the two 439division. Unlike the C remainder operator C<%>, this function ensures that
440the return value is always positive and that the two numbers I<m> and
440numbers I<m> and I<m' = m + i * n> result in the same value modulo I<n> - 441I<m' = m + i * n> result in the same value modulo I<n> - in other words,
441the C<%> operator usually has a behaviour change at C<m = 0>. 442C<ecb_mod> implements the mathematical modulo operation, which is missing
443in the language.
442 444
443C<n> must be strictly positive (i.e. C<< >= 1 >>), while C<m> must be 445C<n> must be strictly positive (i.e. C<< >= 1 >>), while C<m> must be
444negatable, that is, both C<m> and C<-m> must be representable in its 446negatable, that is, both C<m> and C<-m> must be representable in its
445type. 447type (this typically includes the minimum signed integer value, the same
448limitation as for C</> and C<%> in C).
446 449
447Current GCC versions compile this into an efficient branchless sequence on 450Current GCC versions compile this into an efficient branchless sequence on
448many systems. 451many systems.
449 452
450For example, when you want to rotate forward through the members of an 453For example, when you want to rotate forward through the members of an

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines