#include "L1Trigger/DTTraco/interface/Lut.h"
Go to the source code of this file.
Functions | |
void | DSPtoIEEE32 (short DSPmantissa, short DSPexp, float *f) |
char | exaDigit (int i) |
void | IEEE32toDSP (float f, short *DSPmantissa, short *DSPexp) |
std::string | lutFmt (int i) |
void DSPtoIEEE32 | ( | short | DSPmantissa, |
short | DSPexp, | ||
float * | f | ||
) |
Definition at line 393 of file Lut.cc.
References funct::pow().
char exaDigit | ( | int | i | ) |
void IEEE32toDSP | ( | float | f, |
short * | DSPmantissa, | ||
short * | DSPexp | ||
) |
Definition at line 402 of file Lut.cc.
{ //long *pl, lm; uint32_t *pl = 0; uint32_t lm; //101104 SV convert float to int in safe way union { float f; uint32_t i; } u; u.f = f; *pl = u.i; bool sign=false; if( f==0.0 ) { *DSPexp = 0; *DSPmantissa = 0; } else { //pl = reinterpret_cast<uint32_t*> (&f); //pl = (long*) (&f); if((*pl & 0x80000000)!=0) sign=true; lm =( 0x800000 | (*pl & 0x7FFFFF)); // [1][23bit mantissa] lm >>= 9; //reduce to 15bits lm &= 0x7FFF; *DSPexp = ((*pl>>23)&0xFF)-126; *DSPmantissa = (short)lm; if(sign) *DSPmantissa = - *DSPmantissa; // convert negative value in 2.s // complement } return; }
std::string lutFmt | ( | int | i | ) |
Definition at line 142 of file Lut.cc.
References exaDigit(), and asciidump::s.