mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
register: ignore strict aliasing for setting register as float
Signed-off-by: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
This commit is contained in:
parent
8a40b873be
commit
033634ac47
1 changed files with 6 additions and 0 deletions
|
@ -69,8 +69,11 @@ void Register::setRegister(size_t reg, float value) {
|
|||
logger->error("Register index out of range: {}/{}", reg, registerNum);
|
||||
throw std::out_of_range("Register index out of range");
|
||||
}
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
Xil_Out32(getBaseAddr(registerMemory) + REGISTER_OUT(reg),
|
||||
reinterpret_cast<uint32_t &>(value));
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
uint32_t Register::getRegister(size_t reg) {
|
||||
|
@ -87,7 +90,10 @@ float Register::getRegisterFloat(size_t reg) {
|
|||
throw std::out_of_range("Register index out of range");
|
||||
}
|
||||
uint32_t value = Xil_In32(getBaseAddr(registerMemory) + REGISTER_OUT(reg));
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
return reinterpret_cast<float &>(value);
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
void Register::resetRegister(size_t reg) {
|
||||
|
|
Loading…
Add table
Reference in a new issue