📄 floatingregister.cpp
字号:
#include "StdAfx.h"
#include "FloatingRegister.h"
FloatingRegister::FloatingRegister(void)
{
Clear();
}
void FloatingRegister::Clear(){
for (int i = 0; i < 16; ++i) RegisterTable.DoubleFloat[i] = 0;
}
void FloatingRegister::SetValueF(int ID, float value){
if (ID < 0 || ID >= 32){
throw RegistersErrorException("Wrong ID");
}
RegisterTable.SingleFloat[ID] = value;
}
void FloatingRegister::SetValueD(int ID, double value){
if (ID < 0 || ID >= 32 || ID % 2 == 1){
throw RegistersErrorException("Wrong ID");
}
RegisterTable.DoubleFloat[ID / 2] = value;
}
float FloatingRegister::GetValueF(int ID){
if (ID < 0 || ID >= 32){
throw RegistersErrorException("Wrong ID");
}
return RegisterTable.SingleFloat[ID];
}
double FloatingRegister::GetValueD(int ID){
if (ID < 0 || ID >= 32 || ID % 2 == 1){
throw RegistersErrorException("Wrong ID");
}
return RegisterTable.DoubleFloat[ID / 2];
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -