mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- Moved the address alignment test macros for memchr(), memcmp(), memcpy(),
memmove() and memset() into "string_headers.h". git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14709 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: math_logb.c,v 1.1 2004-08-12 12:31:16 obarthel Exp $
|
||||
* $Id: math_logb.c,v 1.2 2004-08-14 11:11:01 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -59,7 +59,7 @@ __logb(double x)
|
||||
{
|
||||
double result;
|
||||
|
||||
result = log(x) / log(FLT_RADIX);
|
||||
result = log(x) / log((double)FLT_RADIX);
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_vfprintf.c,v 1.3 2004-08-08 10:55:57 obarthel Exp $
|
||||
* $Id: stdio_vfprintf.c,v 1.4 2004-08-14 11:11:01 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -635,6 +635,7 @@ vfprintf(FILE * stream,const char * format, va_list arg)
|
||||
char * buffer_start = buffer;
|
||||
|
||||
__long_double_t v;
|
||||
int sign;
|
||||
|
||||
output_buffer = buffer_start;
|
||||
|
||||
@ -645,14 +646,14 @@ vfprintf(FILE * stream,const char * format, va_list arg)
|
||||
else
|
||||
v = va_arg(arg, double);
|
||||
|
||||
if(isinf(v) != 0)
|
||||
if((sign = isinf(v)) != 0)
|
||||
{
|
||||
SHOWMSG("infinity");
|
||||
|
||||
strcpy(output_buffer,"Inf");
|
||||
output_len = 3;
|
||||
|
||||
if(v < 0.0)
|
||||
if(sign < 0)
|
||||
SET_FLAG(format_flags,FORMATF_IsNegative);
|
||||
|
||||
fill_character = ' ';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_qsort.c,v 1.1.1.1 2004-07-26 16:32:02 obarthel Exp $
|
||||
* $Id: stdlib_qsort.c,v 1.2 2004-08-14 11:11:01 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -81,7 +81,7 @@
|
||||
/* For an 68030 and beyond the alignment does not matter and you can skip the
|
||||
second half of the test (everything beyond the 'nbytes >= sizeof(long)'). */
|
||||
#if defined(M68020)
|
||||
#define IS_WORD_ALIGNED(a,b) 1
|
||||
#define IS_WORD_ALIGNED(a,b) (1)
|
||||
#else
|
||||
#define IS_WORD_ALIGNED(a,b) (((((unsigned long)(a)) | ((unsigned long)(b))) & 1) == 0)
|
||||
#endif /* M68020 */
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: string_headers.h,v 1.1.1.1 2004-07-26 16:32:14 obarthel Exp $
|
||||
* $Id: string_headers.h,v 1.2 2004-08-14 11:11:01 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -57,4 +57,21 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Address is neither aligned to a word or long word boundary. */
|
||||
#define IS_UNALIGNED(a) ((((unsigned long)(a)) & 1) != 0)
|
||||
|
||||
/* Address is aligned to a word boundary, but not to a long
|
||||
word boundary. */
|
||||
#define IS_SHORT_ALIGNED(a) ((((unsigned long)(a)) & 3) == 2)
|
||||
|
||||
/* Address is aligned to a long word boundary. For an 68030 and beyond the
|
||||
alignment does not matter. */
|
||||
#if defined(M68020)
|
||||
#define IS_LONG_ALIGNED(a) ((((unsigned long)(a)) & 3) == 0)
|
||||
#else
|
||||
#define IS_LONG_ALIGNED(a) (1)
|
||||
#endif /* M68020 */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* _STRING_HEADERS_H */
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: string_memchr.c,v 1.1.1.1 2004-07-26 16:32:15 obarthel Exp $
|
||||
* $Id: string_memchr.c,v 1.2 2004-08-14 11:11:01 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -43,12 +43,6 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define IS_UNALIGNED(a) ((((unsigned long)(a)) & 1) != 0)
|
||||
#define IS_SHORT_ALIGNED(a) ((((unsigned long)(a)) & 3) == 2)
|
||||
#define IS_LONG_ALIGNED(a) ((((unsigned long)(a)) & 1) == 0)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Check if one of the four bytes which make up a long word is zero. */
|
||||
#define LONG_CONTAINS_ZERO_OCTET(x) (((x) + 0xfefefeff) & ~((x) | 0x7f7f7f7f))
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: string_memcmp.c,v 1.2 2004-08-14 10:00:33 obarthel Exp $
|
||||
* $Id: string_memcmp.c,v 1.3 2004-08-14 11:11:01 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -43,12 +43,6 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define IS_UNALIGNED(a) ((((unsigned long)(a)) & 1) != 0)
|
||||
#define IS_SHORT_ALIGNED(a) ((((unsigned long)(a)) & 3) == 2)
|
||||
#define IS_LONG_ALIGNED(a) ((((unsigned long)(a)) & 1) == 0)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
INLINE static int
|
||||
__memcmp(const char *m1,const char *m2,size_t len)
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: string_memcpy.c,v 1.2 2004-08-14 10:00:33 obarthel Exp $
|
||||
* $Id: string_memcpy.c,v 1.3 2004-08-14 11:11:01 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -229,12 +229,6 @@ memcpy(void *dst, const void *src, size_t len)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define IS_UNALIGNED(a) ((((unsigned long)(a)) & 1) != 0)
|
||||
#define IS_SHORT_ALIGNED(a) ((((unsigned long)(a)) & 3) == 2)
|
||||
#define IS_LONG_ALIGNED(a) ((((unsigned long)(a)) & 1) == 0)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
INLINE static void
|
||||
__memcpy(unsigned char * to,unsigned char * from,size_t len)
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: string_memmove.c,v 1.1.1.1 2004-07-26 16:32:16 obarthel Exp $
|
||||
* $Id: string_memmove.c,v 1.2 2004-08-14 11:11:01 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -351,12 +351,6 @@ memmove(void *dest, const void * src, size_t len)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define IS_UNALIGNED(a) ((((unsigned long)(a)) & 1) != 0)
|
||||
#define IS_SHORT_ALIGNED(a) ((((unsigned long)(a)) & 3) == 2)
|
||||
#define IS_LONG_ALIGNED(a) ((((unsigned long)(a)) & 1) == 0)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
INLINE static void
|
||||
__memmove(unsigned char * to,unsigned char * from,size_t len)
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: string_memset.c,v 1.2 2004-08-14 10:00:33 obarthel Exp $
|
||||
* $Id: string_memset.c,v 1.3 2004-08-14 11:11:01 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -43,12 +43,6 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define IS_UNALIGNED(a) ((((unsigned long)(a)) & 1) != 0)
|
||||
#define IS_SHORT_ALIGNED(a) ((((unsigned long)(a)) & 3) == 2)
|
||||
#define IS_LONG_ALIGNED(a) ((((unsigned long)(a)) & 1) == 0)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
INLINE static void
|
||||
__memset(unsigned char * to,unsigned char value,size_t len)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user