| Index: source/i18n/scriptset.cpp
|
| diff --git a/source/i18n/scriptset.cpp b/source/i18n/scriptset.cpp
|
| index 5f635d030658a4c072cf59df1f516e2900a44bba..9be244e0bbfebf4ab34b45fec7bffea6f68a0385 100644
|
| --- a/source/i18n/scriptset.cpp
|
| +++ b/source/i18n/scriptset.cpp
|
| @@ -1,6 +1,6 @@
|
| /*
|
| **********************************************************************
|
| -* Copyright (C) 2013, International Business Machines
|
| +* Copyright (C) 2014, International Business Machines
|
| * Corporation and others. All Rights Reserved.
|
| **********************************************************************
|
| *
|
| @@ -17,18 +17,17 @@
|
|
|
| #include "scriptset.h"
|
| #include "uassert.h"
|
| +#include "cmemory.h"
|
|
|
| U_NAMESPACE_BEGIN
|
|
|
| -#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
|
| -
|
| //----------------------------------------------------------------------------
|
| //
|
| // ScriptSet implementation
|
| //
|
| //----------------------------------------------------------------------------
|
| ScriptSet::ScriptSet() {
|
| - for (uint32_t i=0; i<LENGTHOF(bits); i++) {
|
| + for (uint32_t i=0; i<UPRV_LENGTHOF(bits); i++) {
|
| bits[i] = 0;
|
| }
|
| }
|
| @@ -42,7 +41,7 @@ ScriptSet::ScriptSet(const ScriptSet &other) {
|
|
|
|
|
| ScriptSet & ScriptSet::operator =(const ScriptSet &other) {
|
| - for (uint32_t i=0; i<LENGTHOF(bits); i++) {
|
| + for (uint32_t i=0; i<UPRV_LENGTHOF(bits); i++) {
|
| bits[i] = other.bits[i];
|
| }
|
| return *this;
|
| @@ -50,7 +49,7 @@ ScriptSet & ScriptSet::operator =(const ScriptSet &other) {
|
|
|
|
|
| UBool ScriptSet::operator == (const ScriptSet &other) const {
|
| - for (uint32_t i=0; i<LENGTHOF(bits); i++) {
|
| + for (uint32_t i=0; i<UPRV_LENGTHOF(bits); i++) {
|
| if (bits[i] != other.bits[i]) {
|
| return FALSE;
|
| }
|
| @@ -103,14 +102,14 @@ ScriptSet &ScriptSet::reset(UScriptCode script, UErrorCode &status) {
|
|
|
|
|
| ScriptSet &ScriptSet::Union(const ScriptSet &other) {
|
| - for (uint32_t i=0; i<LENGTHOF(bits); i++) {
|
| + for (uint32_t i=0; i<UPRV_LENGTHOF(bits); i++) {
|
| bits[i] |= other.bits[i];
|
| }
|
| return *this;
|
| }
|
|
|
| ScriptSet &ScriptSet::intersect(const ScriptSet &other) {
|
| - for (uint32_t i=0; i<LENGTHOF(bits); i++) {
|
| + for (uint32_t i=0; i<UPRV_LENGTHOF(bits); i++) {
|
| bits[i] &= other.bits[i];
|
| }
|
| return *this;
|
| @@ -126,7 +125,7 @@ ScriptSet &ScriptSet::intersect(UScriptCode script, UErrorCode &status) {
|
| }
|
|
|
| UBool ScriptSet::intersects(const ScriptSet &other) const {
|
| - for (uint32_t i=0; i<LENGTHOF(bits); i++) {
|
| + for (uint32_t i=0; i<UPRV_LENGTHOF(bits); i++) {
|
| if ((bits[i] & other.bits[i]) != 0) {
|
| return true;
|
| }
|
| @@ -142,7 +141,7 @@ UBool ScriptSet::contains(const ScriptSet &other) const {
|
|
|
|
|
| ScriptSet &ScriptSet::setAll() {
|
| - for (uint32_t i=0; i<LENGTHOF(bits); i++) {
|
| + for (uint32_t i=0; i<UPRV_LENGTHOF(bits); i++) {
|
| bits[i] = 0xffffffffu;
|
| }
|
| return *this;
|
| @@ -150,7 +149,7 @@ ScriptSet &ScriptSet::setAll() {
|
|
|
|
|
| ScriptSet &ScriptSet::resetAll() {
|
| - for (uint32_t i=0; i<LENGTHOF(bits); i++) {
|
| + for (uint32_t i=0; i<UPRV_LENGTHOF(bits); i++) {
|
| bits[i] = 0;
|
| }
|
| return *this;
|
| @@ -160,7 +159,7 @@ int32_t ScriptSet::countMembers() const {
|
| // This bit counter is good for sparse numbers of '1's, which is
|
| // very much the case that we will usually have.
|
| int32_t count = 0;
|
| - for (uint32_t i=0; i<LENGTHOF(bits); i++) {
|
| + for (uint32_t i=0; i<UPRV_LENGTHOF(bits); i++) {
|
| uint32_t x = bits[i];
|
| while (x > 0) {
|
| count++;
|
| @@ -172,7 +171,7 @@ int32_t ScriptSet::countMembers() const {
|
|
|
| int32_t ScriptSet::hashCode() const {
|
| int32_t hash = 0;
|
| - for (int32_t i=0; i<LENGTHOF(bits); i++) {
|
| + for (int32_t i=0; i<UPRV_LENGTHOF(bits); i++) {
|
| hash ^= bits[i];
|
| }
|
| return hash;
|
|
|