📄 swizzle.c
字号:
/* <LIC_AMD_STD> * Copyright (C) 2003-2005 Advanced Micro Devices, Inc. All Rights Reserved. * * Unless otherwise designated in writing, this software and any related * documentation are the confidential proprietary information of AMD. * THESE MATERIALS ARE PROVIDED "AS IS" WITHOUT ANY * UNLESS OTHERWISE NOTED IN WRITING, EXPRESS OR IMPLIED WARRANTY OF ANY * KIND, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, * NONINFRINGEMENT, TITLE, FITNESS FOR ANY PARTICULAR PURPOSE AND IN NO * EVENT SHALL AMD OR ITS LICENSORS BE LIABLE FOR ANY DAMAGES WHATSOEVER. * * AMD does not assume any responsibility for any errors which may appear * in the Materials nor any responsibility to support or update the * Materials. AMD retains the right to modify the Materials at any time, * without notice, and is not obligated to provide such modified * Materials to you. AMD is not obligated to furnish, support, or make * any further information available to you. * </LIC_AMD_STD> *//* <CTL_AMD_STD> * File Id and RCS Info: * $Source: /home/cvs/travis/env/swizzle.c,v $ * $Id: swizzle.c,v 1.2 2003/12/05 16:10:04 eswartz Exp $ *======================================================================= * Revision History: * $Log: swizzle.c,v $ * Revision 1.2 2003/12/05 16:10:04 eswartz * Removed "#include altm.h" * * Revision 1.1.1.1 2003/06/23 16:05:51 benoy * initial * * Revision 1.4 2003-03-27 16:28:41-06 nathans * magic endian fixes. endian sucks! * * Revision 1.3 2002-07-26 09:38:06-05 nathans * remove ICK! * * Revision 1.2 2002-07-26 09:32:42-05 nathans * #include "swizzle.h" * * Revision 1.1 2002-07-25 14:15:53-05 nathans * change VPI_Linux ugliness to endianness * * Revision 1.0 2002-07-25 13:43:59-05 nathans * Initial revision * * Revision 1.0 2002-04-30 09:44:25-05 nathans * Initial revision * </CTL_AMD_STD> *//* <DOC_AMD_STD> * </DOC_AMD_STD> */#include "swizzle.h"voiduint64_swizzle(uint32 *ptr){#if __BYTE_ORDER == __LITTLE_ENDIAN uint32 w0 = ptr[0]; uint32 w1 = ptr[1]; ptr[0] = w1; ptr[1] = w0;#else#endif}voiduint32_swizzle(char *ptr){#if __BYTE_ORDER == __LITTLE_ENDIAN char b0 = ptr[0]; char b1 = ptr[1]; char b2 = ptr[2]; char b3 = ptr[3]; ptr[0] = b3; ptr[1] = b2; ptr[2] = b1; ptr[3] = b0;#else#endif}voiduint16_swizzle(char *ptr){#if __BYTE_ORDER == __LITTLE_ENDIAN char b0 = ptr[0]; char b1 = ptr[1]; ptr[0] = b1; ptr[1] = b0;#else#endif}voiduint8_swizzle(char *ptr){#if __BYTE_ORDER == __LITTLE_ENDIAN#else#endif}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -