1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/src/nsTextFragmentImpl.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,32 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsTextFragmentImpl_h__ 1.10 +#define nsTextFragmentImpl_h__ 1.11 + 1.12 +#include <stdint.h> 1.13 + 1.14 +template<size_t size> struct Non8BitParameters; 1.15 +template<> struct Non8BitParameters<4> { 1.16 + static inline size_t mask() { return 0xff00ff00; } 1.17 + static inline uint32_t alignMask() { return 0x3; } 1.18 + static inline uint32_t numUnicharsPerWord() { return 2; } 1.19 +}; 1.20 + 1.21 +template<> struct Non8BitParameters<8> { 1.22 + static inline size_t mask() { 1.23 + static const uint64_t maskAsUint64 = 0xff00ff00ff00ff00ULL; 1.24 + // We have to explicitly cast this 64-bit value to a size_t, or else 1.25 + // compilers for 32-bit platforms will warn about it being too large to fit 1.26 + // in the size_t return type. (Fortunately, this code isn't actually 1.27 + // invoked on 32-bit platforms -- they'll use the <4> specialization above. 1.28 + // So it is, in fact, OK that this value is too large for a 32-bit size_t.) 1.29 + return (size_t)maskAsUint64; 1.30 + } 1.31 + static inline uint32_t alignMask() { return 0x7; } 1.32 + static inline uint32_t numUnicharsPerWord() { return 4; } 1.33 +}; 1.34 + 1.35 +#endif