зеркало из https://github.com/mozilla/gecko-dev.git
Actually fix bustage: JS_STATIC_ASSERT cannot be used in classes.
This commit is contained in:
Родитель
02072a227a
Коммит
9e5d5e342e
|
@ -43,7 +43,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
#include "jsutil.h"
|
|
||||||
#include "jsbit.h"
|
#include "jsbit.h"
|
||||||
|
|
||||||
/* Library of template meta-programs for use in the C++ JS data-structures. */
|
/* Library of template meta-programs for use in the C++ JS data-structures. */
|
||||||
|
@ -74,12 +73,16 @@ template <class T> struct BitSize {
|
||||||
static const size_t result = sizeof(T) * JS_BITS_PER_BYTE;
|
static const size_t result = sizeof(T) * JS_BITS_PER_BYTE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Allow Assertions by only including the 'result' typedef if 'true'. */
|
||||||
|
template <bool> struct StaticAssert {};
|
||||||
|
template <> struct StaticAssert<true> { typedef int result; };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Produce an N-bit mask, where N <= BitSize<size_t>::result. Handle the
|
* Produce an N-bit mask, where N <= BitSize<size_t>::result. Handle the
|
||||||
* language-undefined edge case when N = BitSize<size_t>::result.
|
* language-undefined edge case when N = BitSize<size_t>::result.
|
||||||
*/
|
*/
|
||||||
template <size_t N> struct NBitMask {
|
template <size_t N> struct NBitMask {
|
||||||
JS_STATIC_ASSERT(N < BitSize<size_t>::result);
|
typedef typename StaticAssert<N < BitSize<size_t>::result>::result _;
|
||||||
static const size_t result = ~((size_t(1) << N) - 1);
|
static const size_t result = ~((size_t(1) << N) - 1);
|
||||||
};
|
};
|
||||||
template <> struct NBitMask<BitSize<size_t>::result> {
|
template <> struct NBitMask<BitSize<size_t>::result> {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче