// Copyright (c) the JPEG XL Project Authors. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file.
namespace jxl { namespace {
uint8_t ByteKind1(uint8_t b) { if ('a' <= b && b <= 'z') return 0; if ('A' <= b && b <= 'Z') return 0; if ('0' <= b && b <= '9') return 1; if (b == '.' || b == ',') return 1; if (b == 0) return 2; if (b == 1) return 3; if (b < 16) return 4; if (b == 255) return 6; if (b > 240) return 5; return 7;
}
uint8_t ByteKind2(uint8_t b) { if ('a' <= b && b <= 'z') return 0; if ('A' <= b && b <= 'Z') return 0; if ('0' <= b && b <= '9') return 1; if (b == '.' || b == ',') return 1; if (b < 16) return 2; if (b > 240) return 3; return 4;
}
template <typename T>
T PredictValue(T p1, T p2, T p3, int order) { if (order == 0) return p1; if (order == 1) return 2 * p1 - p2; if (order == 2) return 3 * p1 - 3 * p2 + p3; return 0;
}
} // namespace
// Checks if a + b > size, taking possible integer overflow into account.
Status CheckOutOfBounds(uint64_t a, uint64_t b, uint64_t size) {
uint64_t pos = a + b; if (pos > size) return JXL_FAILURE("Out of bounds"); if (pos < a) return JXL_FAILURE("Out of bounds"); // overflow happened returntrue;
}
Status CheckIs32Bit(uint64_t v) { static constexpr const uint64_t kUpper32 = ~static_cast<uint64_t>(0xFFFFFFFF); if ((v & kUpper32) != 0) return JXL_FAILURE("32-bit value expected"); returntrue;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.