mirror of
https://github.com/thestk/stk
synced 2026-01-15 14:01:52 +00:00
Version 2.01
This commit is contained in:
committed by
Stephen Sinclair
parent
6485746ee9
commit
ea749b71d2
29
swapstuf.cpp
Normal file
29
swapstuf.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
int SwapInt (int inf)
|
||||
{
|
||||
int o;
|
||||
unsigned char *inp,*outp;
|
||||
inp=(unsigned char *)&inf;
|
||||
outp=(unsigned char *)&o;
|
||||
outp[0]=inp[3]; outp[1]=inp[2]; outp[2]=inp[1]; outp[3]=inp[0];
|
||||
return(o);
|
||||
}
|
||||
|
||||
short SwapShort (short inf)
|
||||
{
|
||||
short o;
|
||||
unsigned char *inp,*outp;
|
||||
inp=(unsigned char *)&inf;
|
||||
outp=(unsigned char *)&o;
|
||||
outp[0]=inp[1]; outp[1]=inp[0];
|
||||
return(o);
|
||||
}
|
||||
|
||||
float SwapFloat (float inf)
|
||||
{
|
||||
float o;
|
||||
unsigned char *inp,*outp;
|
||||
inp=(unsigned char *)&inf;
|
||||
outp=(unsigned char *)&o;
|
||||
outp[0]=inp[3]; outp[1]=inp[2]; outp[2]=inp[1]; outp[3]=inp[0];
|
||||
return(o);
|
||||
}
|
||||
Reference in New Issue
Block a user