~ubuntu-branches/ubuntu/saucy/clamav/saucy-backports

« back to all changes in this revision

Viewing changes to libclamav/7z/CpuArch.h

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2014-07-15 01:08:10 UTC
  • mfrom: (0.35.47 sid)
  • Revision ID: package-import@ubuntu.com-20140715010810-ru66ek4fun2iseba
Tags: 0.98.4+dfsg-2~ubuntu13.10.1
No-change backport to saucy (LP: #1341962)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* CpuArch.h -- CPU specific code
2
 
2010-10-26: Igor Pavlov : Public domain */
3
 
 
4
 
#ifndef __CPU_ARCH_H
5
 
#define __CPU_ARCH_H
6
 
 
7
 
#include "Types.h"
8
 
#include "others.h"
9
 
 
10
 
EXTERN_C_BEGIN
11
 
 
12
 
/*
13
 
MY_CPU_LE means that CPU is LITTLE ENDIAN.
14
 
If MY_CPU_LE is not defined, we don't know about that property of platform (it can be LITTLE ENDIAN).
15
 
 
16
 
MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned memory accesses.
17
 
If MY_CPU_LE_UNALIGN is not defined, we don't know about these properties of platform.
18
 
*/
19
 
 
20
 
#define GetUi16(p) (cli_readint16(p))
21
 
#define GetUi32(p) (cli_readint32(p))
22
 
 
23
 
#define GetUi64(p) (GetUi32(p) | ((UInt64)GetUi32(((const Byte *)(p)) + 4) << 32))
24
 
 
25
 
#define SetUi16(p, d) { UInt32 _x_ = (d); \
26
 
    ((Byte *)(p))[0] = (Byte)_x_; \
27
 
    ((Byte *)(p))[1] = (Byte)(_x_ >> 8); }
28
 
 
29
 
#define SetUi32(p, d) (cli_writeint32(p, d))
30
 
 
31
 
#define SetUi64(p, d) { UInt64 _x64_ = (d); \
32
 
    SetUi32(p, (UInt32)_x64_); \
33
 
    SetUi32(((Byte *)(p)) + 4, (UInt32)(_x64_ >> 32)); }
34
 
 
35
 
#define GetBe16(p) (((UInt16)((const Byte *)(p))[0] << 8) | ((const Byte *)(p))[1])
36
 
 
37
 
#endif
 
1
/* CpuArch.h -- CPU specific code
 
2
2010-10-26: Igor Pavlov : Public domain */
 
3
 
 
4
#ifndef __CPU_ARCH_H
 
5
#define __CPU_ARCH_H
 
6
 
 
7
#include "Types.h"
 
8
#include "others.h"
 
9
 
 
10
EXTERN_C_BEGIN
 
11
 
 
12
/*
 
13
MY_CPU_LE means that CPU is LITTLE ENDIAN.
 
14
If MY_CPU_LE is not defined, we don't know about that property of platform (it can be LITTLE ENDIAN).
 
15
 
 
16
MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned memory accesses.
 
17
If MY_CPU_LE_UNALIGN is not defined, we don't know about these properties of platform.
 
18
*/
 
19
 
 
20
#define GetUi16(p) (cli_readint16(p))
 
21
#define GetUi32(p) (cli_readint32(p))
 
22
 
 
23
#define GetUi64(p) (GetUi32(p) | ((UInt64)GetUi32(((const Byte *)(p)) + 4) << 32))
 
24
 
 
25
#define SetUi16(p, d) { UInt32 _x_ = (d); \
 
26
    ((Byte *)(p))[0] = (Byte)_x_; \
 
27
    ((Byte *)(p))[1] = (Byte)(_x_ >> 8); }
 
28
 
 
29
#define SetUi32(p, d) (cli_writeint32(p, d))
 
30
 
 
31
#define SetUi64(p, d) { UInt64 _x64_ = (d); \
 
32
    SetUi32(p, (UInt32)_x64_); \
 
33
    SetUi32(((Byte *)(p)) + 4, (UInt32)(_x64_ >> 32)); }
 
34
 
 
35
#define GetBe16(p) (((UInt16)((const Byte *)(p))[0] << 8) | ((const Byte *)(p))[1])
 
36
 
 
37
#endif