X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fhelper%2Fbinarybuffer.h;h=d07a15a148c619d1df3bd23d4fb92c48a5233e3a;hp=5e97cd0337c26645739d7987e7a53b7f67c011c4;hb=3813fda44adcea486b7308423a699f63d79273ee;hpb=b06f254b248db04c71f685c811e4371ea8ae8ff3 diff --git a/src/helper/binarybuffer.h b/src/helper/binarybuffer.h index 5e97cd0337..d07a15a148 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