зеркало из https://github.com/mozilla/pjs.git
Add static assertions as requested in bug 726298 comment 2 and 4.
--HG-- extra : rebase_source : 3edf2446076dae08c16b121de18505174c84f370
This commit is contained in:
Родитель
42f40e6ee9
Коммит
01a54bf05a
|
@ -1062,7 +1062,7 @@ class HashMap
|
|||
*/
|
||||
typedef typename Impl::Range Range;
|
||||
Range all() const { return impl.all(); }
|
||||
size_t count() const { return impl.count(); }
|
||||
uint32_t count() const { return impl.count(); }
|
||||
size_t capacity() const { return impl.capacity(); }
|
||||
size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const {
|
||||
return impl.sizeOfExcludingThis(mallocSizeOf);
|
||||
|
@ -1272,7 +1272,7 @@ class HashSet
|
|||
*/
|
||||
typedef typename Impl::Range Range;
|
||||
Range all() const { return impl.all(); }
|
||||
size_t count() const { return impl.count(); }
|
||||
uint32_t count() const { return impl.count(); }
|
||||
size_t capacity() const { return impl.capacity(); }
|
||||
size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const {
|
||||
return impl.sizeOfExcludingThis(mallocSizeOf);
|
||||
|
|
|
@ -288,7 +288,8 @@ JSBool
|
|||
MapObject::size(JSContext *cx, unsigned argc, Value *vp)
|
||||
{
|
||||
THIS_MAP(get, cx, argc, vp, args, map);
|
||||
args.rval().setNumber(double(map.count()));
|
||||
JS_STATIC_ASSERT(sizeof map.count() <= sizeof(uint32_t));
|
||||
args.rval().setNumber(map.count());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -457,7 +458,8 @@ JSBool
|
|||
SetObject::size(JSContext *cx, unsigned argc, Value *vp)
|
||||
{
|
||||
THIS_SET(has, cx, argc, vp, args, set);
|
||||
args.rval().setNumber(double(set.count()));
|
||||
JS_STATIC_ASSERT(sizeof set.count() <= sizeof(uint32_t));
|
||||
args.rval().setNumber(set.count());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче