mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-25 09:57:32 +09:00
Issue #2241 - Part 2: Add SameValueZero implementation to mfbt/FloatingPoint.h
Backported from Mozilla bug 1560658. This is to prevent duplication of code while implementing DOMMatrix operations.
This commit is contained in:
parent
ec2fb72568
commit
621868a340
2 changed files with 27 additions and 0 deletions
|
|
@ -8,6 +8,8 @@
|
|||
#ifndef js_Equality_h
|
||||
#define js_Equality_h
|
||||
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
|
||||
#include "jstypes.h" // JS_PUBLIC_API
|
||||
|
||||
#include "js/RootingAPI.h" // JS::Handle
|
||||
|
|
@ -50,6 +52,17 @@ LooselyEqual(JSContext* cx, JS::Handle<JS::Value> v1, JS::Handle<JS::Value> v2,
|
|||
extern JS_PUBLIC_API(bool)
|
||||
SameValue(JSContext* cx, JS::Handle<JS::Value> v1, JS::Handle<JS::Value> v2, bool* same);
|
||||
|
||||
/**
|
||||
* Implements |SameValueZero(v1, v2)| for Number values |v1| and |v2|.
|
||||
* SameValueZero equates NaNs, equal nonzero values, and zeroes without respect
|
||||
* to their signs.
|
||||
*/
|
||||
static inline bool
|
||||
SameValueZero(double v1, double v2)
|
||||
{
|
||||
return mozilla::EqualOrBothNaN(v1, v2);
|
||||
}
|
||||
|
||||
} // namespace JS
|
||||
|
||||
#endif /* js_Equality_h */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue