Issue #1240 - Part 3b - Implement WrappingOperations.h for wraparound math operations & conversions. https://bugzilla.mozilla.org/show_bug.cgi?id=1441657 Implement mozilla::WrappingMultiply. Prerequisite for our V8 fast forward.

This commit is contained in:
Brian Smith 2023-07-13 03:27:12 -05:00 • committed by roytam1
commit d42d5ce138
7 changed files with 328 additions and 10 deletions

View file

@ -11,6 +11,7 @@
#include "mozilla/Casting.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/TypeTraits.h"
#include "mozilla/WrappingOperations.h"
#include <math.h>

View file

@ -14,6 +14,7 @@
#include "mozilla/Scoped.h"
#include "mozilla/TemplateLib.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/WrappingOperations.h"
#include <stdlib.h>
#include <string.h>
@ -539,7 +540,7 @@ ScrambleHashCode(HashNumber h)
* are stored in a hash table; see Knuth for details.
*/
static const HashNumber goldenRatio = 0x9E3779B9U;
return h * goldenRatio;
return mozilla::WrappingMultiply(h, goldenRatio);
}
} /* namespace detail */