18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci *  Copyright (C) 2005 Mike Isely <isely@pobox.com>
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci#ifndef __PVRUSB2_UTIL_H
78c2ecf20Sopenharmony_ci#define __PVRUSB2_UTIL_H
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#define PVR2_DECOMPOSE_LE(t,i,d) \
108c2ecf20Sopenharmony_ci    do {    \
118c2ecf20Sopenharmony_ci	(t)[i] = (d) & 0xff;\
128c2ecf20Sopenharmony_ci	(t)[i+1] = ((d) >> 8) & 0xff;\
138c2ecf20Sopenharmony_ci	(t)[i+2] = ((d) >> 16) & 0xff;\
148c2ecf20Sopenharmony_ci	(t)[i+3] = ((d) >> 24) & 0xff;\
158c2ecf20Sopenharmony_ci    } while(0)
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define PVR2_DECOMPOSE_BE(t,i,d) \
188c2ecf20Sopenharmony_ci    do {    \
198c2ecf20Sopenharmony_ci	(t)[i+3] = (d) & 0xff;\
208c2ecf20Sopenharmony_ci	(t)[i+2] = ((d) >> 8) & 0xff;\
218c2ecf20Sopenharmony_ci	(t)[i+1] = ((d) >> 16) & 0xff;\
228c2ecf20Sopenharmony_ci	(t)[i] = ((d) >> 24) & 0xff;\
238c2ecf20Sopenharmony_ci    } while(0)
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#define PVR2_COMPOSE_LE(t,i) \
268c2ecf20Sopenharmony_ci    ((((u32)((t)[i+3])) << 24) | \
278c2ecf20Sopenharmony_ci     (((u32)((t)[i+2])) << 16) | \
288c2ecf20Sopenharmony_ci     (((u32)((t)[i+1])) << 8) | \
298c2ecf20Sopenharmony_ci     ((u32)((t)[i])))
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#define PVR2_COMPOSE_BE(t,i) \
328c2ecf20Sopenharmony_ci    ((((u32)((t)[i])) << 24) | \
338c2ecf20Sopenharmony_ci     (((u32)((t)[i+1])) << 16) | \
348c2ecf20Sopenharmony_ci     (((u32)((t)[i+2])) << 8) | \
358c2ecf20Sopenharmony_ci     ((u32)((t)[i+3])))
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#endif /* __PVRUSB2_UTIL_H */
39