Kaydet (Commit) 7abe976b authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Avoid undefined mis-aligned memory access

(assuming this shall always be little endian, given "Intel" in the function names)

Change-Id: Iff7e1305108dd0f8d9fae762c1f715e2e7b481b3
üst 9b57a0ae
...@@ -76,16 +76,16 @@ namespace OpenStormBento ...@@ -76,16 +76,16 @@ namespace OpenStormBento
typedef const Name * pConst##Name typedef const Name * pConst##Name
inline UtWord UtGetIntelWord(UtByte * pData) inline UtWord UtGetIntelWord(UtByte * pData)
{ return * (UtWord *) pData; } { return pData[0] | pData[1] << 8; }
inline UtDWord UtGetIntelDWord(UtByte * pData) inline UtDWord UtGetIntelDWord(UtByte * pData)
{ return * (UtDWord *) pData; } { return pData[0] | pData[1] << 8 | pData[2] << 16 | pData[3] << 24; }
inline void UtPutIntelWord(UtByte * pData, UtWord Val) inline void UtPutIntelWord(UtByte * pData, UtWord Val)
{ * (UtWord *) pData = Val; } { pData[0] = Val; pData[1] = Val >> 8; }
inline void UtPutIntelDWord(UtByte * pData, UtDWord Val) inline void UtPutIntelDWord(UtByte * pData, UtDWord Val)
{ * (UtDWord *) pData = Val; } { pData[0] = Val; pData[1] = Val >> 8; pData[2] = Val >> 16; pData[3] = Val >> 24; }
inline UtByte UtGetIntelByte(UtByte * pData) inline UtByte UtGetIntelByte(UtByte * pData)
{ return * pData; } { return * pData; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment