libfirmware gets efi::size (#4354)

This commit is contained in:
Matthew Kennedy 2022-07-17 22:56:58 -07:00 committed by GitHub
parent 213c746066
commit 492a5db2fb
6 changed files with 5 additions and 31 deletions

View File

@ -5,6 +5,8 @@
* @author Andrey Belomutskiy, (c) 2012-2021
*/
#include "pch.h"
#include "bmw_n73.h"
void setEngineProteusBMW_N73_GDI() {

View File

@ -7,8 +7,6 @@
#pragma once
#include "engine_configuration.h"
void setEngineProteusBMW_N73_GDI();
void setEngineProteusGearboxManInTheMiddle();

View File

@ -5,8 +5,9 @@
* @author Andrey Belomutskiy, (c) 2012-2021
*/
#include "pch.h"
#include "hyundai.h"
#include "map.h"
static void commonGenesisCoupe() {
strncpy(config->luaScript, R"(

View File

@ -7,8 +7,5 @@
#pragma once
#include "engine_configuration.h"
void setGenesisCoupeBK1();
void setGenesisCoupeBK2();

@ -1 +1 @@
Subproject commit 8fcca4c0ce715a3c44ad13bb1a1a9316dbe63605
Subproject commit 7fea28f1c1b1fde209258e97824b8b16ef0ace19

View File

@ -92,30 +92,6 @@ float limitRateOfChange(float newValue, float oldValue, float incrLimitPerSec, f
#define IS_NEGATIVE_ZERO(value) (__builtin_signbit(value) && value==0)
#define fixNegativeZero(value) (IS_NEGATIVE_ZERO(value) ? 0 : value)
// C++ helpers go here
namespace efi
{
template <typename T, size_t N>
constexpr size_t size(const T(&)[N]) {
return N;
}
// Zero the passed object
template <typename T>
constexpr void clear(T* obj) {
// The cast to void* is to prevent errors like:
// clearing an object of non-trivial type 'struct persistent_config_s'; use assignment or value-initialization instead
// This is technically wrong, but we know config objects only ever actually
// contain integral types, though they may be wrapped in a scaled_channel
memset(reinterpret_cast<void*>(obj), 0, sizeof(T));
}
template <typename T>
constexpr void clear(T& obj) {
clear(&obj);
}
} // namespace efi
#define assertIsInBounds(length, array, msg) efiAssertVoid(OBD_PCM_Processor_Fault, std::is_unsigned_v<decltype(length)> && (length) < efi::size(array), msg)
#define assertIsInBoundsWithResult(length, array, msg, failedResult) efiAssert(OBD_PCM_Processor_Fault, std::is_unsigned_v<decltype(length)> && (length) < efi::size(array), msg, failedResult)