diff options
| author | SND\gschwind_cp <SND\gschwind_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-12-07 16:07:53 +0000 |
|---|---|---|
| committer | SND\gschwind_cp <SND\gschwind_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-12-07 16:07:53 +0000 |
| commit | f03cd2c04ac944d672444a6562d8f1593264a794 (patch) | |
| tree | 210489249db84419f8f5a23473877262913c4bfa /plugins/gxvideo/swap.h | |
| parent | 2461ae5676a3898492c3d87b07f495a37f829c2a (diff) | |
| download | pcsxr-f03cd2c04ac944d672444a6562d8f1593264a794.tar.gz | |
first commit of gxvideo plugin (fork of dfxvideo)
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@60768 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'plugins/gxvideo/swap.h')
| -rw-r--r-- | plugins/gxvideo/swap.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/plugins/gxvideo/swap.h b/plugins/gxvideo/swap.h new file mode 100644 index 00000000..06d23d39 --- /dev/null +++ b/plugins/gxvideo/swap.h @@ -0,0 +1,26 @@ +#include <stdint.h> + +// byteswappings + +#define SWAP16(x) ({ uint16_t y=(x); (((y)>>8 & 0xff) | ((y)<<8 & 0xff00)); }) +#define SWAP32(x) ({ uint32_t y=(x); (((y)>>24 & 0xfful) | ((y)>>8 & 0xff00ul) | ((y)<<8 & 0xff0000ul) | ((y)<<24 & 0xff000000ul)); }) + +// little endian config +#define HOST2LE32(x) (x) +#define HOST2BE32(x) SWAP32(x) +#define LE2HOST32(x) (x) +#define BE2HOST32(x) SWAP32(x) + +#define HOST2LE16(x) (x) +#define HOST2BE16(x) SWAP16(x) +#define LE2HOST16(x) (x) +#define BE2HOST16(x) SWAP16(x) + +#define GETLEs16(X) ((int16_t)GETLE16((uint16_t *)X)) +#define GETLEs32(X) ((int16_t)GETLE32((uint16_t *)X)) + +#define GETLE16(X) LE2HOST16(*(uint16_t *)X) +#define GETLE32(X) LE2HOST32(*(uint32_t *)X) +#define GETLE16D(X) ({uint32_t val = GETLE32(X); (val<<16 | val >> 16);}) +#define PUTLE16(X, Y) do{*((uint16_t *)X)=HOST2LE16((uint16_t)Y);}while(0) +#define PUTLE32(X, Y) do{*((uint32_t *)X)=HOST2LE16((uint32_t)Y);}while(0) |
