summaryrefslogtreecommitdiff
path: root/src/net/win2mac.cpp
blob: d6da2cf21babce9e6102f28c4592c480dee1b98e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "win2mac.h"

#define SWAP( a,  b ) { char c; c=a; a=b; b=c; }

UInt32 DR_SwapFourBytes(UInt32 dw)
{
    UInt32 tmp;
    tmp =  (dw & 0x000000FF);
    tmp = ((dw & 0x0000FF00) >> 0x08) | (tmp << 0x08);
    tmp = ((dw & 0x00FF0000) >> 0x10) | (tmp << 0x08);
    tmp = ((dw & 0xFF000000) >> 0x18) | (tmp << 0x08);
    return (tmp);
}

UInt16 DR_SwapTwoBytes(UInt16 w)
{
    UInt16 tmp;
    tmp =  (w & 0x00FF);
    tmp = ((w & 0xFF00) >> 0x08) | (tmp << 0x08);
    return(tmp);
}

char* SwapChar(char charlist[])
{
    for (int i = 0; i < 24 / 2; i++)
    {
        SWAP(charlist[i], charlist[24 - i]);
    }

    return charlist;
}