Bug 1842773 - Part 5: Add ArrayBuffer.prototype.{maxByteLength,resizable} getters...
[gecko.git] / dom / base / nsTextFragmentImpl.h
blob0e22c6f44c23eb0452eef5a8259658ac44f815f6
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsTextFragmentImpl_h__
8 #define nsTextFragmentImpl_h__
10 #include <stdint.h>
12 template <size_t size>
13 struct Non8BitParameters;
14 template <>
15 struct Non8BitParameters<4> {
16 static inline size_t mask() { return 0xff00ff00; }
17 static inline uint32_t alignMask() { return 0x3; }
18 static inline uint32_t numUnicharsPerWord() { return 2; }
21 template <>
22 struct Non8BitParameters<8> {
23 static inline size_t mask() {
24 static const uint64_t maskAsUint64 = 0xff00ff00ff00ff00ULL;
25 // We have to explicitly cast this 64-bit value to a size_t, or else
26 // compilers for 32-bit platforms will warn about it being too large to fit
27 // in the size_t return type. (Fortunately, this code isn't actually
28 // invoked on 32-bit platforms -- they'll use the <4> specialization above.
29 // So it is, in fact, OK that this value is too large for a 32-bit size_t.)
30 return (size_t)maskAsUint64;
32 static inline uint32_t alignMask() { return 0x7; }
33 static inline uint32_t numUnicharsPerWord() { return 4; }
36 #endif