| version 1.10, 2002/10/02 20:13:59 |
version 1.11, 2002/10/11 20:21:37 |
|
|
| /* |
/* @file platon/str/strmmx.c |
| * string functions based on mmx instructions |
* @author Lynx <mizon@centrum.sk> |
| |
* String functions based on mmx instructions |
| */ |
*/ |
| #ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
| # include "config.h" |
# include "config.h" |
|
|
| #include <unistd.h> |
#include <unistd.h> |
| |
|
| #include <platon/str/strmmx.h> |
#include <platon/str/strmmx.h> |
| |
/* Function for align string length to multiple of 8 |
| |
*/ |
| static int align(const int n) |
static int align(const int n) |
| { |
{ |
| return ((n >> 3) + (n % 8 != 0)) << 3; |
return ((n >> 3) + (n % 8 != 0)) << 3; |
| Line 31 char *PLATON_FUNC(strncpymmx)(void *dest |
|
| Line 33 char *PLATON_FUNC(strncpymmx)(void *dest |
|
| ret[n] = '\0'; |
ret[n] = '\0'; |
| return ret; |
return ret; |
| } |
} |
| |
/* Function copy memory regions |
| |
*/ |
| void *PLATON_FUNC(memcpymmx)(void *dest, const void *src, size_t n) |
void *PLATON_FUNC(memcpymmx)(void *dest, const void *src, size_t n) |
| { |
{ |
| if ((n % 8) != 0) |
if ((n % 8) != 0) |
| Line 46 void *PLATON_FUNC(memcpymmx)(void *dest, |
|
| Line 49 void *PLATON_FUNC(memcpymmx)(void *dest, |
|
| :"memory"); |
:"memory"); |
| return dest; |
return dest; |
| } |
} |
| |
/* Function set every item of buffer to char 'c' |
| |
*/ |
| void *PLATON_FUNC(memsetmmx)(void *s, int c, size_t n) |
void *PLATON_FUNC(memsetmmx)(void *s, int c, size_t n) |
| { |
{ |
| char set[8]; |
char set[8]; |
| Line 63 void *PLATON_FUNC(memsetmmx)(void *s, in |
|
| Line 67 void *PLATON_FUNC(memsetmmx)(void *s, in |
|
| return s; |
return s; |
| } |
} |
| |
|
| /* function returns only 1 or 0 */ |
/* Function compare two memory regions,return 0 or 1 |
| |
*/ |
| int PLATON_FUNC(memcmpmmx)(const void *s1, const void *s2, size_t n) |
int PLATON_FUNC(memcmpmmx)(const void *s1, const void *s2, size_t n) |
| { |
{ |
| if ((n % 8) != 0) |
if ((n % 8) != 0) |
| Line 89 int PLATON_FUNC(memcmpmmx)(const void *s |
|
| Line 94 int PLATON_FUNC(memcmpmmx)(const void *s |
|
| |
|
| #if defined(SELF) || defined(SELFTEST) || defined(SELF_MMX) |
#if defined(SELF) || defined(SELFTEST) || defined(SELF_MMX) |
| |
|
| /* testujeme memcpymmx */ |
|
| int main(int argc, char *argv[]) |
int main(int argc, char *argv[]) |
| { |
{ |
| char *pole1, *pole2; |
char *pole1, *pole2; |