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/. */
9 #include "nsCycleCollectionNoteChild.h"
11 #include "mozilla/CheckedInt.h"
12 #include "mozilla/IntegerPrintfMacros.h"
14 // Ensure this is sufficiently aligned so that Elements() and co don't create
15 // unaligned pointers, or slices with unaligned pointers for empty arrays, see
16 // https://github.com/servo/servo/issues/22613.
17 alignas(8) const nsTArrayHeader sEmptyTArrayHeader
= {0, 0, 0};
19 bool IsTwiceTheRequiredBytesRepresentableAsUint32(size_t aCapacity
,
21 using mozilla::CheckedUint32
;
22 return ((CheckedUint32(aCapacity
) * aElemSize
) * 2).isValid();
25 void ::detail::SetCycleCollectionArrayFlag(uint32_t& aFlags
) {
26 aFlags
|= CycleCollectionEdgeNameArrayFlag
;