/*
* Copyright (c) 2018-2020 Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include
namespace ams::kern {
/* Ensure that we generate correct class tokens for all types. */
/* Ensure that the absolute token values are correct. */
static_assert(ClassToken == 0b00000000'00000000);
static_assert(ClassToken == 0b00000000'00000001);
static_assert(ClassToken == 0b00000000'00000011);
static_assert(ClassToken == 0b00000111'00000011);
static_assert(ClassToken == 0b00001011'00000001);
static_assert(ClassToken == 0b00010011'00000001);
static_assert(ClassToken == 0b00100011'00000001);
static_assert(ClassToken == 0b01000011'00000001);
static_assert(ClassToken == 0b10000011'00000001);
static_assert(ClassToken == 0b00001101'00000000);
static_assert(ClassToken == 0b00010101'00000001);
static_assert(ClassToken == 0b00100101'00000000);
static_assert(ClassToken == 0b01000101'00000000);
static_assert(ClassToken == 0b10000101'00000000);
static_assert(ClassToken == 0b00011001'00000000);
static_assert(ClassToken == 0b00101001'00000000);
static_assert(ClassToken == 0b01001001'00000000);
static_assert(ClassToken == 0b10001001'00000000);
static_assert(ClassToken == 0b00110001'00000000);
static_assert(ClassToken == 0b01010001'00000000);
static_assert(ClassToken == 0b10010001'00000000);
static_assert(ClassToken == 0b01100001'00000000);
static_assert(ClassToken == 0b10100001'00000000);
static_assert(ClassToken == 0b11000001'00000000);
/* Ensure that the token hierarchy is correct. */
/* Base classes */
static_assert(ClassToken == (0b00000000));
static_assert(ClassToken == (0b00000001 | ClassToken));
static_assert(ClassToken == (0b00000010 | ClassToken));
/* Final classes */
static_assert(ClassToken == ((0b00000111 << 8) | ClassToken));
static_assert(ClassToken == ((0b00001011 << 8) | ClassToken));
static_assert(ClassToken == ((0b00010011 << 8) | ClassToken));
static_assert(ClassToken == ((0b00100011 << 8) | ClassToken));
static_assert(ClassToken == ((0b01000011 << 8) | ClassToken));
static_assert(ClassToken == ((0b10000011 << 8) | ClassToken));
static_assert(ClassToken == ((0b00001101 << 8) | ClassToken));
static_assert(ClassToken == ((0b00010101 << 8) | ClassToken));
static_assert(ClassToken == ((0b00100101 << 8) | ClassToken));
static_assert(ClassToken == ((0b01000101 << 8) | ClassToken));
static_assert(ClassToken == ((0b10000101 << 8) | ClassToken));
static_assert(ClassToken == ((0b00011001 << 8) | ClassToken));
static_assert(ClassToken == ((0b00101001 << 8) | ClassToken));
static_assert(ClassToken == ((0b01001001 << 8) | ClassToken));
static_assert(ClassToken == ((0b10001001 << 8) | ClassToken));
static_assert(ClassToken == ((0b00110001 << 8) | ClassToken));
static_assert(ClassToken == ((0b01010001 << 8) | ClassToken));
static_assert(ClassToken == ((0b10010001 << 8) | ClassToken));
static_assert(ClassToken == ((0b01100001 << 8) | ClassToken));
static_assert(ClassToken == ((0b10100001 << 8) | ClassToken));
static_assert(ClassToken == ((0b11000001 << 8) | ClassToken));
/* Ensure that the token hierarchy reflects the class hierarchy. */
/* Base classes. */
static_assert(!std::is_final::value && std::is_base_of::value);
static_assert(!std::is_final::value && std::is_base_of::value);
/* Final classes */
static_assert(std::is_final::value && std::is_base_of::value);
static_assert(std::is_final::value && std::is_base_of::value);
static_assert(std::is_final::value && std::is_base_of::value);
static_assert(std::is_final::value && std::is_base_of::value);
static_assert(std::is_final::value && std::is_base_of::value);
static_assert(std::is_final::value && std::is_base_of::value);
static_assert(std::is_final::value && std::is_base_of::value);
static_assert(std::is_final::value && std::is_base_of::value);
static_assert(std::is_final::value && std::is_base_of::value);
static_assert(std::is_final::value && std::is_base_of::value);
static_assert(std::is_final::value && std::is_base_of::value);
static_assert(std::is_final::value && std::is_base_of::value);
static_assert(std::is_final::value && std::is_base_of::value);
static_assert(std::is_final::value && std::is_base_of::value);
static_assert(std::is_final::value && std::is_base_of::value);
static_assert(std::is_final::value && std::is_base_of::value);
static_assert(std::is_final::value && std::is_base_of::value);
static_assert(std::is_final::value && std::is_base_of::value);
static_assert(std::is_final::value && std::is_base_of::value);
static_assert(std::is_final::value && std::is_base_of::value);
static_assert(std::is_final::value && std::is_base_of::value);
}