From df5ce07bff868aa2265016bb22b36f92e01a1b82 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Fri, 16 Apr 2004 06:21:42 +0000 Subject: [PATCH] Reverted last change since, as Axel pointed out, old version is "a bit" faster than the new one git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7219 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/BTextView/WidthBuffer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kits/interface/BTextView/WidthBuffer.cpp b/src/kits/interface/BTextView/WidthBuffer.cpp index 9560ef25ce..f0d0564038 100644 --- a/src/kits/interface/BTextView/WidthBuffer.cpp +++ b/src/kits/interface/BTextView/WidthBuffer.cpp @@ -236,7 +236,7 @@ _BWidthBuffer_::GetEscapement(uint32 value, int32 index, float *escapement) { _width_table_ *table = &fBuffer[index]; hashed_escapement *widths = static_cast(table->widths); - uint32 hashed = Hash(value) % table->tableCount; + uint32 hashed = Hash(value) & (table->tableCount - 1); DEBUG_ONLY(uint32 iterations = 1;) uint32 found; @@ -306,7 +306,7 @@ _BWidthBuffer_::HashEscapements(const char *inText, int32 numChars, int32 textLe uint32 value = CharToCode(inText + offset, charLen); - uint32 hashed = Hash(value) % table->tableCount; + uint32 hashed = Hash(value) & (table->tableCount - 1); uint32 found = widths[hashed].code; // Check if the value is already in the table @@ -341,7 +341,7 @@ _BWidthBuffer_::HashEscapements(const char *inText, int32 numChars, int32 textLe // Rehash the values, and put them into the new table for (int32 oldPos = 0; oldPos < table->tableCount; oldPos++) { if (widths[oldPos].code != (uint32) -1) { - uint32 newPos = Hash(widths[oldPos].code) % newSize; + uint32 newPos = Hash(widths[oldPos].code) & (newSize - 1); while (newWidths[newPos].code != (uint32)-1) { if (++newPos >= (uint32)newSize) newPos = 0;