HashScalar.h#
Fully qualified name: carb/HashScalar.h
File members: carb/HashScalar.h
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: LicenseRef-NvidiaProprietary
//
// NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
// property and proprietary rights in and to this material, related
// documentation and any modifications thereto. Any use, reproduction,
// disclosure or distribution of this material and related documentation
// without an express license agreement from NVIDIA CORPORATION or
// its affiliates is strictly prohibited.
#pragma once
// This is a separate file to avoid always including the expensive <type_traits>
#include "Hash.h"
#include <memory>
#include <type_traits>
namespace carb
{
template <class T>
inline uint64_t hashScalar(const T& type, uint64_t hash = kFnvBasis)
{
static_assert(std::is_scalar<T>::value, "Unsupported type for hashing");
return hashBuffer(std::addressof(type), sizeof(type), hash);
}
} // namespace carb