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