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

Comparing cvsroot/libecb/ecb.pod (file contents):
Revision 1.27 by root, Wed Jun 1 01:29:36 2011 UTC vs.
Revision 1.31 by root, Fri Jun 17 15:17:26 2011 UTC

101 #else 101 #else
102 return 0; 102 return 0;
103 #endif 103 #endif
104 } 104 }
105 105
106=item ecb_inline
107
108This is not actually an attribute, but you use it like one. It expands
109either to C<static inline> or to just C<static>, if inline isn't
110supported. It should be used to declare functions that should be inlined,
111for code size or speed reasons.
112
113Example: inline this function, it surely will reduce codesize.
114
115 ecb_inline int
116 negmul (int a, int b)
117 {
118 return - (a * b);
119 }
120
106=item ecb_noinline 121=item ecb_noinline
107 122
108Prevent a function from being inlined - it might be optimised away, but 123Prevent a function from being inlined - it might be optimised away, but
109not inlined into other functions. This is useful if you know your function 124not inlined into other functions. This is useful if you know your function
110is rarely called and large enough for inlining not to be helpful. 125is rarely called and large enough for inlining not to be helpful.
448C<ecb_mod> implements the mathematical modulo operation, which is missing 463C<ecb_mod> implements the mathematical modulo operation, which is missing
449in the language. 464in the language.
450 465
451C<n> must be strictly positive (i.e. C<< >= 1 >>), while C<m> must be 466C<n> must be strictly positive (i.e. C<< >= 1 >>), while C<m> must be
452negatable, that is, both C<m> and C<-m> must be representable in its 467negatable, that is, both C<m> and C<-m> must be representable in its
453type (this typically includes the minimum signed integer value, the same 468type (this typically excludes the minimum signed integer value, the same
454limitation as for C</> and C<%> in C). 469limitation as for C</> and C<%> in C).
455 470
456Current GCC versions compile this into an efficient branchless sequence on 471Current GCC versions compile this into an efficient branchless sequence on
457many systems. 472almost all CPUs.
458 473
459For example, when you want to rotate forward through the members of an 474For example, when you want to rotate forward through the members of an
460array for increasing C<m> (which might be negative), then you should use 475array for increasing C<m> (which might be negative), then you should use
461C<ecb_mod>, as the C<%> operator might give either negative results, or 476C<ecb_mod>, as the C<%> operator might give either negative results, or
462change direction for negative values: 477change direction for negative values:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines