OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [LINUX_2_4_26_OR32/] [linux/] [linux-2.4/] [fs/] [ntfs/] [ntfsendian.h] - Blame information for rev 1780

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 * ntfsendian.h
3
 *
4
 * Copyright (C) 1998, 1999 Martin von Löwis
5
 * Copyright (C) 1998 Joseph Malicki
6
 * Copyright (C) 1999 Werner Seiler
7
 * Copyright (C) 2001 Anton Altaparmakov (AIA)
8
 */
9
#include <asm/byteorder.h>
10
 
11
#define CPU_TO_LE16(a) __cpu_to_le16(a)
12
#define CPU_TO_LE32(a) __cpu_to_le32(a)
13
#define CPU_TO_LE64(a) __cpu_to_le64(a)
14
 
15
#define LE16_TO_CPU(a) __cpu_to_le16(a)
16
#define LE32_TO_CPU(a) __cpu_to_le32(a)
17
#define LE64_TO_CPU(a) __cpu_to_le64(a)
18
 
19
#define NTFS_GETU8(p)      (*(ntfs_u8*)(p))
20
#define NTFS_GETU16(p)     ((ntfs_u16)LE16_TO_CPU(*(ntfs_u16*)(p)))
21
#define NTFS_GETU24(p)     ((ntfs_u32)NTFS_GETU16(p) | \
22
                           ((ntfs_u32)NTFS_GETU8(((char*)(p)) + 2) << 16))
23
#define NTFS_GETU32(p)     ((ntfs_u32)LE32_TO_CPU(*(ntfs_u32*)(p)))
24
#define NTFS_GETU40(p)     ((ntfs_u64)NTFS_GETU32(p) | \
25
                           (((ntfs_u64)NTFS_GETU8(((char*)(p)) + 4)) << 32))
26
#define NTFS_GETU48(p)     ((ntfs_u64)NTFS_GETU32(p) | \
27
                           (((ntfs_u64)NTFS_GETU16(((char*)(p)) + 4)) << 32))
28
#define NTFS_GETU56(p)     ((ntfs_u64)NTFS_GETU32(p) | \
29
                           (((ntfs_u64)NTFS_GETU24(((char*)(p)) + 4)) << 32))
30
#define NTFS_GETU64(p)     ((ntfs_u64)LE64_TO_CPU(*(ntfs_u64*)(p)))
31
 
32
 /* Macros writing unsigned integers */
33
#define NTFS_PUTU8(p,v)      ((*(ntfs_u8*)(p)) = (v))
34
#define NTFS_PUTU16(p,v)     ((*(ntfs_u16*)(p)) = CPU_TO_LE16(v))
35
#define NTFS_PUTU24(p,v)     NTFS_PUTU16(p, (v) & 0xFFFF);\
36
                             NTFS_PUTU8(((char*)(p)) + 2, (v) >> 16)
37
#define NTFS_PUTU32(p,v)     ((*(ntfs_u32*)(p)) = CPU_TO_LE32(v))
38
#define NTFS_PUTU64(p,v)     ((*(ntfs_u64*)(p)) = CPU_TO_LE64(v))
39
 
40
 /* Macros reading signed integers */
41
#define NTFS_GETS8(p)        ((*(ntfs_s8*)(p)))
42
#define NTFS_GETS16(p)       ((ntfs_s16)LE16_TO_CPU(*(short*)(p)))
43
#define NTFS_GETS24(p)       (NTFS_GETU24(p) < 0x800000 ? \
44
                                        (int)NTFS_GETU24(p) : \
45
                                        (int)(NTFS_GETU24(p) - 0x1000000))
46
#define NTFS_GETS32(p)       ((ntfs_s32)LE32_TO_CPU(*(int*)(p)))
47
#define NTFS_GETS40(p)       (((ntfs_s64)NTFS_GETU32(p)) | \
48
                             (((ntfs_s64)NTFS_GETS8(((char*)(p)) + 4)) << 32))
49
#define NTFS_GETS48(p)       (((ntfs_s64)NTFS_GETU32(p)) | \
50
                             (((ntfs_s64)NTFS_GETS16(((char*)(p)) + 4)) << 32))
51
#define NTFS_GETS56(p)       (((ntfs_s64)NTFS_GETU32(p)) | \
52
                             (((ntfs_s64)NTFS_GETS24(((char*)(p)) + 4)) << 32))
53
#define NTFS_GETS64(p)       ((ntfs_s64)NTFS_GETU64(p))
54
 
55
#define NTFS_PUTS8(p,v)      NTFS_PUTU8(p,v)
56
#define NTFS_PUTS16(p,v)     NTFS_PUTU16(p,v)
57
#define NTFS_PUTS24(p,v)     NTFS_PUTU24(p,v)
58
#define NTFS_PUTS32(p,v)     NTFS_PUTU32(p,v)
59
#define NTFS_PUTS64(p,v)     NTFS_PUTU64(p,v)
60
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.