mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-20 20:19:32 +00:00
ICU-3132 make the type of le_bool be bool, and get rid of the #defines for true and false.
X-SVN-Rev: 14018
This commit is contained in:
parent
8a44aa4a02
commit
82d931c474
2 changed files with 22 additions and 23 deletions
|
@ -19,8 +19,15 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
#define SWAPW(value) (LESwaps::isBigEndian() ? (value) : LESwaps::swapWord(value))
|
||||
|
||||
#if defined(U_IS_BIG_ENDIAN)
|
||||
#if U_IS_BIG_ENDIAN
|
||||
#define SWAPW(value) (value)
|
||||
#else
|
||||
#define SWAPW(value) LESwaps::swapWord(value)
|
||||
#endif
|
||||
#else
|
||||
#define SWAPW(value) (LESwaps::isBigEndian() ? (value) : LESwaps::swapWord(value))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* A convenience macro which invokes the swapLong member function
|
||||
|
@ -28,7 +35,15 @@ U_NAMESPACE_BEGIN
|
|||
*
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
#define SWAPL(value) (LESwaps::isBigEndian() ? (value) : LESwaps::swapLong(value))
|
||||
#if defined(U_IS_BIG_ENDIAN)
|
||||
#if U_IS_BIG_ENDIAN
|
||||
#define SWAPL(value) (value)
|
||||
#else
|
||||
#define SWAPL(value) LESwaps::swapLong(value)
|
||||
#endif
|
||||
#else
|
||||
#define SWAPL(value) (LESwaps::isBigEndian() ? (value) : LESwaps::swapLong(value))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This class is used to access data which stored in big endian order
|
||||
|
@ -44,6 +59,7 @@ U_NAMESPACE_BEGIN
|
|||
class U_LAYOUT_API LESwaps /* not : public UObject because all methods are static */ {
|
||||
public:
|
||||
|
||||
#if !defined(U_IS_BIG_ENDIAN)
|
||||
/**
|
||||
* This method detects the endian-ness of the platform by
|
||||
* casting a pointer to a word to a pointer to a byte. On
|
||||
|
@ -55,12 +71,13 @@ public:
|
|||
*
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
static le_bool isBigEndian()
|
||||
static le_uint8 isBigEndian()
|
||||
{
|
||||
const le_uint16 word = 0xFF00;
|
||||
|
||||
return *((le_uint8 *) &word);
|
||||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This method does the byte swap required on little endian platforms
|
||||
|
|
|
@ -70,25 +70,7 @@ typedef uint8_t le_uint8;
|
|||
*
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
typedef UBool le_bool;
|
||||
|
||||
#ifndef true
|
||||
/**
|
||||
* Used for <code>le_bool</code> values which are <code>true</code>.
|
||||
*
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define true 1
|
||||
#endif
|
||||
|
||||
#ifndef false
|
||||
/**
|
||||
* Used for <code>le_bool</code> values which are <code>false</code>.
|
||||
*
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define false 0
|
||||
#endif
|
||||
typedef bool le_bool;
|
||||
|
||||
#ifndef NULL
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue