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

Comparing libecb/ecb.pod (file contents):
Revision 1.38 by sf-exg, Thu Aug 25 16:06:08 2011 UTC vs.
Revision 1.41 by root, Mon May 28 08:40:25 2012 UTC

53C<uint32_t>, then the corresponding function works only with that type. If 53C<uint32_t>, then the corresponding function works only with that type. If
54only a generic name is used (C<expr>, C<cond>, C<value> and so on), then 54only a generic name is used (C<expr>, C<cond>, C<value> and so on), then
55the corresponding function relies on C to implement the correct types, and 55the corresponding function relies on C to implement the correct types, and
56is usually implemented as a macro. Specifically, a "bool" in this manual 56is usually implemented as a macro. Specifically, a "bool" in this manual
57refers to any kind of boolean value, not a specific type. 57refers to any kind of boolean value, not a specific type.
58
59=head2 TYPES / TYPE SUPPORT
60
61ecb.h makes sure that the following types are defined (in the expected way):
62
63 int8_t uint8_t int16_t uint16_t
64 int32_t uint32_t int64_t uint64_t
65 intptr_t uintptr_t
66
67The macro C<ECB_PTRSIZE> is defined to the size of a pointer on this
68platform (currently C<4> or C<8>).
58 69
59=head2 GCC ATTRIBUTES 70=head2 GCC ATTRIBUTES
60 71
61A major part of libecb deals with GCC attributes. These are additional 72A major part of libecb deals with GCC attributes. These are additional
62attributes that you can assign to functions, variables and sometimes even 73attributes that you can assign to functions, variables and sometimes even
425For example: 436For example:
426 437
427 ecb_ctz32 (3) = 0 438 ecb_ctz32 (3) = 0
428 ecb_ctz32 (6) = 1 439 ecb_ctz32 (6) = 1
429 440
441=item bool ecb_is_pot32 (uint32_t x)
442
443=item bool ecb_is_pot64 (uint32_t x)
444
445Return true iff C<x> is a power of two or C<x == 0>.
446
447For smaller types then C<uint32_t> you can safely use C<ecb_is_pot32>.
448
430=item int ecb_ld32 (uint32_t x) 449=item int ecb_ld32 (uint32_t x)
431 450
432=item int ecb_ld64 (uint64_t x) 451=item int ecb_ld64 (uint64_t x)
433 452
434Returns the index of the most significant bit set in C<x>, or the number 453Returns the index of the most significant bit set in C<x>, or the number
454 473
455For example: 474For example:
456 475
457 ecb_popcount32 (7) = 3 476 ecb_popcount32 (7) = 3
458 ecb_popcount32 (255) = 8 477 ecb_popcount32 (255) = 8
478
479=item uint8_t ecb_bitrev8 (uint8_t x)
480
481=item uint16_t ecb_bitrev16 (uint16_t x)
482
483=item uint32_t ecb_bitrev32 (uint32_t x)
484
485Reverses the bits in x, i.e. the MSB becomes the LSB, MSB-1 becomes LSB+1
486and so on.
487
488Example:
489
490 ecb_bitrev8 (0xa7) = 0xea
491 ecb_bitrev32 (0xffcc4411) = 0x882233ff
459 492
460=item uint32_t ecb_bswap16 (uint32_t x) 493=item uint32_t ecb_bswap16 (uint32_t x)
461 494
462=item uint32_t ecb_bswap32 (uint32_t x) 495=item uint32_t ecb_bswap32 (uint32_t x)
463 496

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines