Some JMA format and code improvements.

This commit is contained in:
n-a-c-h
2004-11-26 01:26:50 +00:00
parent 1c7223557d
commit 760e6a53a5
3 changed files with 25 additions and 12 deletions

View File

@@ -62,6 +62,7 @@ template <class T> inline T MyMax(T a, T b) {
#define UINT_SIZE (4)
#define USHORT_SIZE (2)
//Convert an array of 4 bytes back into an integer
inline unsigned int charp_to_uint(const unsigned char buffer[UINT_SIZE])
@@ -73,4 +74,12 @@ inline unsigned int charp_to_uint(const unsigned char buffer[UINT_SIZE])
return(num);
}
//Convert an array of 2 bytes back into a short integer
inline unsigned short charp_to_ushort(const unsigned char buffer[USHORT_SIZE])
{
unsigned short num = (unsigned short)buffer[1];
num |= ((unsigned short)buffer[0]) << 8;
return(num);
}
#endif