1bf7ab50dSStephan Aßmus /* 2bf7ab50dSStephan Aßmus * Copyright 2003-2007 Marcus Overhagen 3bf7ab50dSStephan Aßmus * Copyright 2007 Haiku Inc. All rights reserved. 4bf7ab50dSStephan Aßmus * Distributed under the terms of the MIT License. 5bf7ab50dSStephan Aßmus */ 6526735b2Sbeveloper #ifndef _BYTE_SWAP_H 7526735b2Sbeveloper #define _BYTE_SWAP_H 8526735b2Sbeveloper 9*a9cf57cfSAxel Dörfler 10bf7ab50dSStephan Aßmus #include <SupportDefs.h> 11526735b2Sbeveloper 12*a9cf57cfSAxel Dörfler 13*a9cf57cfSAxel Dörfler class ByteSwap { 14526735b2Sbeveloper public: 15526735b2Sbeveloper ByteSwap(uint32 format); 16526735b2Sbeveloper ~ByteSwap(); 17526735b2Sbeveloper 18526735b2Sbeveloper void Swap(void *buffer, size_t bytecount); 19526735b2Sbeveloper 20526735b2Sbeveloper private: 21526735b2Sbeveloper void (*fFunc)(void *, size_t); 22526735b2Sbeveloper }; 23526735b2Sbeveloper 24*a9cf57cfSAxel Dörfler 25526735b2Sbeveloper inline void Swap(void * buffer,size_t bytecount)26526735b2SbeveloperByteSwap::Swap(void *buffer, size_t bytecount) 27526735b2Sbeveloper { 28526735b2Sbeveloper (*fFunc)(buffer, bytecount); 29526735b2Sbeveloper } 30*a9cf57cfSAxel Dörfler 31*a9cf57cfSAxel Dörfler #endif // _BYTE_SWAP_H 32