mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-26 07:00:17 +08:00
Replaces nested else-if with else if for consistency and readability. No functional changes. Signed-off-by: Vysochyn, Illia <illia.vysochyn@intel.com>
40 lines
913 B
C++
40 lines
913 B
C++
/*
|
|
* Copyright (C) 2021-2025 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <stddef.h>
|
|
|
|
namespace NEO {
|
|
|
|
template <typename Type, bool fullStateProperty>
|
|
struct StreamPropertyType {
|
|
static constexpr Type initValue = static_cast<Type>(-1);
|
|
|
|
Type value = initValue;
|
|
bool isDirty = false;
|
|
void set(Type newValue) {
|
|
if constexpr (fullStateProperty) {
|
|
if ((value != newValue) && (newValue != initValue)) {
|
|
value = newValue;
|
|
isDirty = true;
|
|
}
|
|
} else if (newValue != initValue) {
|
|
value = newValue;
|
|
}
|
|
}
|
|
};
|
|
|
|
using StreamProperty32 = StreamPropertyType<int32_t, true>;
|
|
using StreamProperty64 = StreamPropertyType<int64_t, true>;
|
|
using StreamPropertySizeT = StreamPropertyType<size_t, false>;
|
|
|
|
using StreamProperty = StreamProperty32;
|
|
|
|
} // namespace NEO
|