+#else
+#error Unknown architecture.
+#endif
+
+static void AddLengthToCells( UInt32 numCells, UInt32 *cells, UInt64 offset)
+{
+ if (numCells == 1)
+ {
+ cells[0] += (UInt32)offset;
+ }
+ else {
+#if defined(__arm64__) || defined(__arm__)
+ UInt64 sum = cells[numCells - 2] + offset;
+ cells[numCells - 2] = (UInt32)sum;
+ if (sum > UINT32_MAX) {
+ cells[numCells - 1] += (UInt32)(sum >> 32);
+ }
+#else
+ UInt64 sum = cells[numCells - 1] + offset;
+ cells[numCells - 1] = (UInt32)sum;
+ if (sum > UINT32_MAX) {
+ cells[numCells - 2] += (UInt32)(sum >> 32);
+ }
+#endif
+ }
+}
+
+static IOPhysicalAddress CellsValue( UInt32 numCells, UInt32 *cells)
+{
+ if (numCells == 1) {
+ return IOPhysical32( 0, cells[0] );
+ } else {
+#if defined(__arm64__) || defined(arm)
+ return IOPhysical32( cells[numCells - 1], cells[numCells - 2] );
+#else
+ return IOPhysical32( cells[numCells - 2], cells[numCells - 1] );
+#endif
+ }
+}