X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fhelper%2Fbinarybuffer.h;h=d1fcd8b9c721d47c75513c7e6a43c20727dcbc9d;hb=aea6815462d3302f7f8b6576f59320d5f5985642;hp=027354129192ee23e6c70cdbb332f56987642550;hpb=655e4f88a6b7fd82a570a17cf1219356f4587a37;p=openocd.git diff --git a/src/helper/binarybuffer.h b/src/helper/binarybuffer.h index 0273541291..d1fcd8b9c7 100644 --- a/src/helper/binarybuffer.h +++ b/src/helper/binarybuffer.h @@ -2,6 +2,9 @@ * Copyright (C) 2004, 2005 by Dominic Rath * * Dominic.Rath@gmx.de * * * + * Copyright (C) 2007,2008 Øyvind Harboe * + * oyvind.harboe@zylin.com * + * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * @@ -27,14 +30,14 @@ */ /* inlining this will help show what fn that is taking time during profiling. */ -static __inline void buf_set_u32(u8* buffer, unsigned int first, unsigned int num, u32 value) +static inline void buf_set_u32(uint8_t* buffer, unsigned int first, unsigned int num, uint32_t value) { - if ((num==32)&&(first==0)) + if ((num==32) && (first==0)) { - buffer[3]=(value>>24)&0xff; - buffer[2]=(value>>16)&0xff; - buffer[1]=(value>>8)&0xff; - buffer[0]=(value>>0)&0xff; + buffer[3]=(value >> 24)&0xff; + buffer[2]=(value >> 16)&0xff; + buffer[1]=(value >> 8)&0xff; + buffer[0]=(value >> 0)&0xff; } else { unsigned int i; @@ -48,14 +51,14 @@ static __inline void buf_set_u32(u8* buffer, unsigned int first, unsigned int nu } } } -static __inline u32 buf_get_u32(u8* buffer, unsigned int first, unsigned int num) +static inline uint32_t buf_get_u32(const uint8_t* buffer, unsigned int first, unsigned int num) { - if ((num==32)&&(first==0)) + if ((num==32) && (first==0)) { - return (((u32)buffer[3])<<24)|(((u32)buffer[2])<<16)|(((u32)buffer[1])<<8)|(((u32)buffer[0])<<0); + return (((uint32_t)buffer[3]) << 24)|(((uint32_t)buffer[2]) << 16)|(((uint32_t)buffer[1]) << 8)|(((uint32_t)buffer[0]) << 0); } else { - u32 result = 0; + uint32_t result = 0; unsigned int i; for (i=first; i