1115013Smarcel/* 2160157SmarcelCopyright (c) 2003-2006 Hewlett-Packard Development Company, L.P. 3121642SmarcelPermission is hereby granted, free of charge, to any person 4121642Smarcelobtaining a copy of this software and associated documentation 5121642Smarcelfiles (the "Software"), to deal in the Software without 6121642Smarcelrestriction, including without limitation the rights to use, 7121642Smarcelcopy, modify, merge, publish, distribute, sublicense, and/or sell 8121642Smarcelcopies of the Software, and to permit persons to whom the 9121642SmarcelSoftware is furnished to do so, subject to the following 10121642Smarcelconditions: 11115013Smarcel 12121642SmarcelThe above copyright notice and this permission notice shall be 13121642Smarcelincluded in all copies or substantial portions of the Software. 14121642Smarcel 15121642SmarcelTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16121642SmarcelEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17121642SmarcelOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18121642SmarcelNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19121642SmarcelHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20121642SmarcelWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21121642SmarcelFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22121642SmarcelOTHER DEALINGS IN THE SOFTWARE. 23121642Smarcel*/ 24121642Smarcel 25115013Smarcel#include "uwx_env.h" 26115013Smarcel#include "uwx_swap.h" 27115013Smarcel 28115013Smarcelvoid uwx_swap4(uint32_t *w) 29115013Smarcel{ 30115013Smarcel unsigned char *p; 31115013Smarcel unsigned char t[4]; 32115013Smarcel 33115013Smarcel p = (unsigned char *) w; 34115013Smarcel 35115013Smarcel t[0] = p[0]; 36115013Smarcel t[1] = p[1]; 37115013Smarcel t[2] = p[2]; 38115013Smarcel t[3] = p[3]; 39115013Smarcel 40115013Smarcel p[0] = t[3]; 41115013Smarcel p[1] = t[2]; 42115013Smarcel p[2] = t[1]; 43115013Smarcel p[3] = t[0]; 44115013Smarcel} 45115013Smarcel 46115013Smarcelvoid uwx_swap8(uint64_t *dw) 47115013Smarcel{ 48115013Smarcel unsigned char *p; 49115013Smarcel unsigned char t[8]; 50115013Smarcel 51115013Smarcel p = (unsigned char *) dw; 52115013Smarcel 53115013Smarcel t[0] = p[0]; 54115013Smarcel t[1] = p[1]; 55115013Smarcel t[2] = p[2]; 56115013Smarcel t[3] = p[3]; 57115013Smarcel t[4] = p[4]; 58115013Smarcel t[5] = p[5]; 59115013Smarcel t[6] = p[6]; 60115013Smarcel t[7] = p[7]; 61115013Smarcel 62115013Smarcel p[0] = t[7]; 63115013Smarcel p[1] = t[6]; 64115013Smarcel p[2] = t[5]; 65115013Smarcel p[3] = t[4]; 66115013Smarcel p[4] = t[3]; 67115013Smarcel p[5] = t[2]; 68115013Smarcel p[6] = t[1]; 69115013Smarcel p[7] = t[0]; 70115013Smarcel} 71