test/hotspot/gtest/utilities/test_align.cpp
changeset 49167 ba9da6aaae36
parent 47216 71c04702a3d5
equal deleted inserted replaced
49166:2879dad8d4ec 49167:ba9da6aaae36
     1 /*
     1 /*
     2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    28 #include "unittest.hpp"
    28 #include "unittest.hpp"
    29 
    29 
    30 #include <limits>
    30 #include <limits>
    31 
    31 
    32 // A few arbitrarily chosen values to test the align functions on.
    32 // A few arbitrarily chosen values to test the align functions on.
    33 static uint64_t values[] = {1, 3, 10, 345, 1023, 1024, 1025, 23909034, INT_MAX, uint64_t(-1) / 2, uint64_t(-1) / 2 + 100, -1 };
    33 static uint64_t values[] = {1, 3, 10, 345, 1023, 1024, 1025, 23909034, INT_MAX, uint64_t(-1) / 2, uint64_t(-1) / 2 + 100, uint64_t(-1)};
    34 
    34 
    35 template <typename T>
    35 template <typename T>
    36 static T max_alignment() {
    36 static T max_alignment() {
    37   T max = std::numeric_limits<T>::max();
    37   T max = std::numeric_limits<T>::max();
    38   return max ^ (max >> 1);
    38   return max ^ (max >> 1);