Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, October 16, 2026

Diff for libcfg+/src/platon/str/strmmx.c between version 1.6 and 1.7

version 1.6, 2002/07/15 19:38:14 version 1.7, 2002/08/16 20:31:43
Line 1 
Line 1 
 /*  /*
  * string functions based on mmx instructions   * string functions based on mmx instructions
  */   */
   #ifdef HAVE_CONFIG_H
   #  include "config.h"
   #endif
   
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
 #include <unistd.h>  #include <unistd.h>
 #include "strmmx.h"  #include "strmmx.h"
   
   #ifndef FUNCTION
   #  define FUNCTION_NAME(_unused, _name) _unused##_name
   #  define FUNCTION(_name) FUNCTION_NAME(, ## _name)
   #endif
   
 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;
 }  }
   
 char *strcpymmx(void *dest, const void *src)          char *FUNCTION(strcpymmx)(void *dest, const void *src)
 {  {
         int len = strlen(src);          int len = strlen(src);
         char *ret = memcpymmx(dest, src, len);          char *ret = memcpymmx(dest, src, len);
         ret[len] = '\0';          ret[len] = '\0';
         return ret;          return ret;
 }  }
 char *strncpymmx(void *dest, const void *src, size_t n)  
           char *FUNCTION(strncpymmx)(void *dest, const void *src, size_t n)
 {  {
         char *ret = memcpymmx(dest, src, n);          char *ret = memcpymmx(dest, src, n);
         ret[n] = '\0';          ret[n] = '\0';
         return ret;          return ret;
 }  }
   
 void *memcpymmx(void *dest, const void *src, size_t n)          void *FUNCTION(memcpymmx)(void *dest, const void *src, size_t n)
 {  {
         if ((n % 8) != 0)          if ((n % 8) != 0)
                 n = align(n);                  n = align(n);
Line 41  void *memcpymmx(void *dest, const void *
Line 51  void *memcpymmx(void *dest, const void *
         return dest;          return dest;
 }  }
   
 void *memsetmmx(void *s, int c, size_t n)          void *FUNCTION(memsetmmx)(void *s, int c, size_t n)
 {  {
         char set[8];          char set[8];
         set[0] = set[1] = set[2] = set[3] = set[4] = set[5] = set[6] = set[7] = c;          set[0] = set[1] = set[2] = set[3] = set[4] = set[5] = set[6] = set[7] = c;
Line 58  void *memsetmmx(void *s, int c, size_t n
Line 68  void *memsetmmx(void *s, int c, size_t n
 }  }
   
 /* function returns only 1 or 0  */  /* function returns only 1 or 0  */
 int memcmpmmx(const void *s1, const void *s2, size_t n)          int FUNCTION(memcmpmmx)(const void *s1, const void *s2, size_t n)
 {  {
         if ((n % 8) != 0)          if ((n % 8) != 0)
                 n = align(n);                  n = align(n);

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top