pvrusb2-util.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. *
  3. * $Id$
  4. *
  5. * Copyright (C) 2005 Mike Isely <isely@pobox.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. *
  20. */
  21. #ifndef __PVRUSB2_UTIL_H
  22. #define __PVRUSB2_UTIL_H
  23. #define PVR2_DECOMPOSE_LE(t,i,d) \
  24. do { \
  25. (t)[i] = (d) & 0xff;\
  26. (t)[i+1] = ((d) >> 8) & 0xff;\
  27. (t)[i+2] = ((d) >> 16) & 0xff;\
  28. (t)[i+3] = ((d) >> 24) & 0xff;\
  29. } while(0)
  30. #define PVR2_DECOMPOSE_BE(t,i,d) \
  31. do { \
  32. (t)[i+3] = (d) & 0xff;\
  33. (t)[i+2] = ((d) >> 8) & 0xff;\
  34. (t)[i+1] = ((d) >> 16) & 0xff;\
  35. (t)[i] = ((d) >> 24) & 0xff;\
  36. } while(0)
  37. #define PVR2_COMPOSE_LE(t,i) \
  38. ((((u32)((t)[i+3])) << 24) | \
  39. (((u32)((t)[i+2])) << 16) | \
  40. (((u32)((t)[i+1])) << 8) | \
  41. ((u32)((t)[i])))
  42. #define PVR2_COMPOSE_BE(t,i) \
  43. ((((u32)((t)[i])) << 24) | \
  44. (((u32)((t)[i+1])) << 16) | \
  45. (((u32)((t)[i+2])) << 8) | \
  46. ((u32)((t)[i+3])))
  47. #endif /* __PVRUSB2_UTIL_H */
  48. /*
  49. Stuff for Emacs to see, in order to encourage consistent editing style:
  50. *** Local Variables: ***
  51. *** mode: c ***
  52. *** fill-column: 75 ***
  53. *** tab-width: 8 ***
  54. *** c-basic-offset: 8 ***
  55. *** End: ***
  56. */