1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
2 | /* |
3 | * |
4 | * Copyright (C) 2005 Mike Isely <isely@pobox.com> |
5 | */ |
6 | #ifndef __PVRUSB2_UTIL_H |
7 | #define __PVRUSB2_UTIL_H |
8 | |
9 | #define PVR2_DECOMPOSE_LE(t,i,d) \ |
10 | do { \ |
11 | (t)[i] = (d) & 0xff;\ |
12 | (t)[i+1] = ((d) >> 8) & 0xff;\ |
13 | (t)[i+2] = ((d) >> 16) & 0xff;\ |
14 | (t)[i+3] = ((d) >> 24) & 0xff;\ |
15 | } while(0) |
16 | |
17 | #define PVR2_DECOMPOSE_BE(t,i,d) \ |
18 | do { \ |
19 | (t)[i+3] = (d) & 0xff;\ |
20 | (t)[i+2] = ((d) >> 8) & 0xff;\ |
21 | (t)[i+1] = ((d) >> 16) & 0xff;\ |
22 | (t)[i] = ((d) >> 24) & 0xff;\ |
23 | } while(0) |
24 | |
25 | #define PVR2_COMPOSE_LE(t,i) \ |
26 | ((((u32)((t)[i+3])) << 24) | \ |
27 | (((u32)((t)[i+2])) << 16) | \ |
28 | (((u32)((t)[i+1])) << 8) | \ |
29 | ((u32)((t)[i]))) |
30 | |
31 | #define PVR2_COMPOSE_BE(t,i) \ |
32 | ((((u32)((t)[i])) << 24) | \ |
33 | (((u32)((t)[i+1])) << 16) | \ |
34 | (((u32)((t)[i+2])) << 8) | \ |
35 | ((u32)((t)[i+3]))) |
36 | |
37 | |
38 | #endif /* __PVRUSB2_UTIL_H */ |
39 | |