13 auto hash_created_string = [](intptr_t
length,
14 intptr_t misalignment) -> uint32_t {
16 char* str =
new char[capacity];
17 const intptr_t alloc_misalignment =
19 const intptr_t first_aligned_position =
20 alloc_misalignment > 0 ?
kInt32Size - alloc_misalignment : 0;
21 const intptr_t
start = first_aligned_position + misalignment;
22 for (intptr_t n = 0; n <
start; n++) {
25 for (intptr_t n = 0; n <
length; n++) {
27 str[
start + n] = 0x40 + (n % 26);
29 for (intptr_t n =
start +
length; n < capacity; n++) {
37 const intptr_t kMaxLength = 100;
39 uint32_t last_hash = hash_created_string(0, 0);
40 bool identical_hashes =
true;
42 for (intptr_t
len = 0;
len < kMaxLength;
len++) {
43 const uint32_t
hash = hash_created_string(
len, 0);
44 for (intptr_t misalignment = 1; misalignment <
kInt64Size; misalignment++) {
45 EXPECT_EQ(
hash, hash_created_string(
len, misalignment));
47 if (
hash != last_hash) {
48 identical_hashes =
false;
126 uword* address =
reinterpret_cast<uword*
>(63);
127 uword* rounddown_address =
reinterpret_cast<uword*
>(32);
135 uword* address =
reinterpret_cast<uword*
>(63);
136 uword* roundup_address =
reinterpret_cast<uword*
>(64);
194#if defined(ARCH_IS_64_BIT)
382 EXPECT_EQ(0x0,
reinterpret_cast<uint8_t*
>(&value16be)[0]);
383 EXPECT_EQ(0xf1,
reinterpret_cast<uint8_t*
>(&value16be)[1]);
386 EXPECT_EQ(0xf1,
reinterpret_cast<uint8_t*
>(&value16le)[0]);
387 EXPECT_EQ(0x0,
reinterpret_cast<uint8_t*
>(&value16le)[1]);
390 EXPECT_EQ(0x0,
reinterpret_cast<uint8_t*
>(&value32be)[0]);
391 EXPECT_EQ(0x0,
reinterpret_cast<uint8_t*
>(&value32be)[1]);
392 EXPECT_EQ(0xf1,
reinterpret_cast<uint8_t*
>(&value32be)[2]);
393 EXPECT_EQ(0xf2,
reinterpret_cast<uint8_t*
>(&value32be)[3]);
397 EXPECT_EQ(0xf2,
reinterpret_cast<uint8_t*
>(&value32le)[0]);
398 EXPECT_EQ(0xf1,
reinterpret_cast<uint8_t*
>(&value32le)[1]);
399 EXPECT_EQ(0x0,
reinterpret_cast<uint8_t*
>(&value32le)[2]);
400 EXPECT_EQ(0x0,
reinterpret_cast<uint8_t*
>(&value32le)[3]);
403 EXPECT_EQ(0x0,
reinterpret_cast<uint8_t*
>(&value64be)[0]);
404 EXPECT_EQ(0x0,
reinterpret_cast<uint8_t*
>(&value64be)[1]);
405 EXPECT_EQ(0x0,
reinterpret_cast<uint8_t*
>(&value64be)[2]);
406 EXPECT_EQ(0x0,
reinterpret_cast<uint8_t*
>(&value64be)[3]);
407 EXPECT_EQ(0xf1,
reinterpret_cast<uint8_t*
>(&value64be)[4]);
408 EXPECT_EQ(0xf2,
reinterpret_cast<uint8_t*
>(&value64be)[5]);
409 EXPECT_EQ(0xf3,
reinterpret_cast<uint8_t*
>(&value64be)[6]);
410 EXPECT_EQ(0xf4,
reinterpret_cast<uint8_t*
>(&value64be)[7]);
413 EXPECT_EQ(0xf4,
reinterpret_cast<uint8_t*
>(&value64le)[0]);
414 EXPECT_EQ(0xf3,
reinterpret_cast<uint8_t*
>(&value64le)[1]);
415 EXPECT_EQ(0xf2,
reinterpret_cast<uint8_t*
>(&value64le)[2]);
416 EXPECT_EQ(0xf1,
reinterpret_cast<uint8_t*
>(&value64le)[3]);
417 EXPECT_EQ(0x0,
reinterpret_cast<uint8_t*
>(&value64le)[4]);
418 EXPECT_EQ(0x0,
reinterpret_cast<uint8_t*
>(&value64le)[5]);
419 EXPECT_EQ(0x0,
reinterpret_cast<uint8_t*
>(&value64le)[6]);
420 EXPECT_EQ(0x0,
reinterpret_cast<uint8_t*
>(&value64le)[7]);
433#if defined(ARCH_IS_64_BIT)
static uint32_t hash(const SkShaderBase::GradientInfo &v)
static uint64_t HostToBigEndian64(uint64_t host_value)
static bool IsInt(intptr_t N, T value)
static int CountLeadingZeros64(uint64_t x)
static constexpr uintptr_t RoundUpToPowerOfTwo(uintptr_t x)
static uint64_t HostToLittleEndian64(uint64_t host_value)
static int32_t Low32Bits(int64_t value)
static int32_t Low16Bits(int32_t value)
static uword ReverseBitsWord(uword x)
static constexpr int CountOneBitsWord(uword x)
static constexpr T Maximum(T x, T y)
static bool MagnitudeIsUint(intptr_t N, T value)
static constexpr int ShiftForPowerOfTwo(T x)
static int CountLeadingZeros32(uint32_t x)
static int CountTrailingZeros64(uint64_t x)
static constexpr T NBitMask(size_t n)
static uint64_t LittleEndianToHost64(uint64_t le_value)
static int CountTrailingZeros32(uint32_t x)
static int32_t High32Bits(int64_t value)
static T Minimum(T x, T y)
static uint16_t HostToLittleEndian16(uint16_t host_value)
static constexpr T RoundUp(T x, uintptr_t alignment, uintptr_t offset=0)
static uint32_t StringHash(const void *data, int length)
static int CountLeadingZerosWord(uword x)
static int64_t LowHighTo64Bits(uint32_t low, int32_t high)
static uint32_t BigEndianToHost32(uint32_t be_value)
static constexpr int CountOneBits32(uint32_t x)
static bool IsUint(intptr_t N, T value)
static int CountTrailingZerosWord(uword x)
static uint32_t HostToLittleEndian32(uint32_t host_value)
static constexpr int CountOneBits64(uint64_t x)
static constexpr T RoundDown(T x, intptr_t alignment)
static int32_t High16Bits(int32_t value)
static constexpr bool IsAligned(T x, uintptr_t alignment, uintptr_t offset=0)
static bool DoublesBitEqual(const double a, const double b)
static uint16_t HostToBigEndian16(uint16_t host_value)
static uint32_t HostToBigEndian32(uint32_t host_value)
static uint32_t ReverseBits32(uint32_t x)
static uint64_t ReverseBits64(uint64_t x)
static constexpr bool IsPowerOfTwo(T x)
constexpr intptr_t kBitsPerWord
constexpr intptr_t kInt64Size
constexpr uword kUwordMax
constexpr intptr_t kInt32Size
VM_UNIT_TEST_CASE(DirectoryCurrentNoScope)
static void RoundUp(Vector< char > buffer, int *length, int *decimal_point)