| version 1.11, 2002/10/11 20:21:37 |
version 1.12, 2003/02/25 11:17:03 |
|
|
| /* @file platon/str/strmmx.c |
|
| * @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" |
| #endif |
#endif |
|
|
| #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 |
/* Function for align string length to multiple of 8 |
| */ |
*/ |
| static int align(const int n) |
static int align(const int n) |
| Line 22 static int align(const int n) |
|
| Line 19 static int align(const int n) |
|
| char *PLATON_FUNC(strcpymmx)(void *dest, const void *src) |
char *PLATON_FUNC(strcpymmx)(void *dest, const void *src) |
| { |
{ |
| int len = strlen(src); |
int len = strlen(src); |
| char *ret = memcpymmx(dest, src, len); |
char *ret = PLATON_FUNC(memcpymmx)(dest, src, len); |
| ret[len] = '\0'; |
ret[len] = '\0'; |
| return ret; |
return ret; |
| } |
} |
| |
|
| char *PLATON_FUNC(strncpymmx)(void *dest, const void *src, size_t n) |
char *PLATON_FUNC(strncpymmx)(void *dest, const void *src, size_t n) |
| { |
{ |
| char *ret = memcpymmx(dest, src, n); |
char *ret = PLATON_FUNC(memcpymmx)(dest, src, n); |
| ret[n] = '\0'; |
ret[n] = '\0'; |
| return ret; |
return ret; |
| } |
} |
| Line 109 int main(int argc, char *argv[]) |
|
| Line 106 int main(int argc, char *argv[]) |
|
| pole1 = (char *) malloc(bsize); |
pole1 = (char *) malloc(bsize); |
| pole2 = (char *) malloc(bsize); |
pole2 = (char *) malloc(bsize); |
| n = atoi(argv[2]) / bsize; |
n = atoi(argv[2]) / bsize; |
| memsetmmx(pole1, 'A', bsize); |
PLATON_FUNC(memsetmmx)(pole1, 'A', bsize); |
| for (i = 0; i <= n; i++) |
for (i = 0; i <= n; i++) |
| memcpymmx(pole2, pole1, bsize); |
PLATON_FUNC(memcpymmx)(pole2, pole1, bsize); |
| |
|
| return 0; |
return 0; |
| } |
} |