VirtualBox

Changeset 1813 in kBuild for trunk/src/kmk


Ignore:
Timestamp:
Oct 10, 2008 6:06:32 AM (16 years ago)
Author:
bird
Message:

kmk: inline memchr everywhere but on linux.

Location:
trunk/src/kmk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/config.h.darwin

    r941 r1813  
    425425/* Define as `fork' if `vfork' does not work. */
    426426/* #undef vfork */
     427
     428#include "inlined_memchr.h"
     429
  • trunk/src/kmk/config.h.freebsd

    r1070 r1813  
    429429/* Define as `fork' if `vfork' does not work. */
    430430/* #undef vfork */
     431
     432#include "inlined_memchr.h"
     433
  • trunk/src/kmk/config.h.os2

    r549 r1813  
    460460#define LIBDIR "."
    461461
     462#include "inlined_memchr.h"
     463
  • trunk/src/kmk/config.h.solaris

    r959 r1813  
    425425/* Define as `fork' if `vfork' does not work. */
    426426/* #undef vfork */
     427
     428#include "inlined_memchr.h"
     429
  • trunk/src/kmk/config.h.win

    r1810 r1813  
    525525#define BATCH_MODE_ONLY_SHELL
    526526
    527 #if defined(_M_X64)
    528 #include <string.h>
    529 static void *
    530 my_inline_memchr(const void *pv, int ch, register size_t cb)
    531 {
    532     register const unsigned int   uch = (unsigned)ch;
    533     register const unsigned char *pb = (const unsigned char *)pv;
    534 #if 1 /* this one beats the CRT (on 2nd gen AMD64). */
    535     while (cb >= 4)
    536     {
    537         if (*pb == uch)
    538             return (unsigned char *)pb;
    539         if (pb[1] == uch)
    540             return (unsigned char *)pb + 1;
    541         if (pb[2] == uch)
    542             return (unsigned char *)pb + 2;
    543         if (pb[3] == uch)
    544             return (unsigned char *)pb + 3;
    545         cb -= 4;
    546         pb += 4;
    547     }
    548     switch (cb & 3)
    549     {
    550         case 0:
    551             break;
    552         case 1:
    553             if (*pb == uch)
    554                 return (unsigned char *)pb;
    555             break;
    556         case 2:
    557             if (*pb == uch)
    558                 return (unsigned char *)pb;
    559             if (pb[1] == uch)
    560                 return (unsigned char *)pb + 1;
    561             break;
    562         case 3:
    563             if (*pb == uch)
    564                 return (unsigned char *)pb;
    565             if (pb[1] == uch)
    566                 return (unsigned char *)pb + 1;
    567             if (pb[2] == uch)
    568                 return (unsigned char *)pb + 2;
    569             break;
    570     }
    571 
    572 #else /* This is just as good the CRT one. */
    573     while (cb > 0)
    574     {
    575         if (*pb == uch)
    576             return (void *)pb;
    577         cb--;
    578         pb++;
    579     }
    580 #endif
    581     return 0;
    582 }
    583 #define memchr my_inline_memchr
    584 #endif
    585 
     527#include "inlined_memchr.h"
     528
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette