memset.c
string.h
ubixos/types.h
sys/_types.h
string.h
src/sys/lib/memset.c
VAL
c0
memset
WIDEVAL
c
memset
wmask
(wsize - 1)
wsize
sizeof(uInt)
void * void* memset (void *dst0, int c0, size_t length) memset void * dst0 int c0 size_t length VAL WIDEVAL wmask wsize

    /*****************************************************************************************
    Copyright(c)2002TheUbixOSProject
    Allrightsreserved.

    Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are
    permittedprovidedthatthefollowingconditionsaremet:

    Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof
    conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary
    formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing
    disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided
    withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits
    contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware
    withoutspecificpriorwrittenpermission.

    THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY
    EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF
    MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL
    THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,
    SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT
    OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION)
    HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR
    TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS
    SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE.

    $Id: memset_8c.xml 88 2016-01-12 00:11:29Z reddawg $

    *****************************************************************************************/

    #include<string.h>

    #definewsizesizeof(uInt)
    #definewmask(wsize-1)
    #defineVALc0
    #defineWIDEVALc

    void*memset(void*dst0,intc0,size_tlength){
    size_tt;
    uIntc;
    uInt8*dst;

    dst=dst0;

    if(length<3*wsize){
    while(length!=0){
    *dst++=VAL;
    --length;
    }
    return(dst0);
    }

    if((c=(uInt8)c0)!=0){/*Filltheword.*/
    c=(c<<8)|c;/*u_intis16bits.*/
    c=(c<<16)|c;/*u_intis32bits.*/
    }

    /*Aligndestinationbyfillinginbytes.*/
    if((t=(long)dst&wmask)!=0){
    t=wsize-t;
    length-=t;
    do{
    *dst++=VAL;
    }while(--t!=0);
    }

    /*Fillwords.Lengthwas>=2*wordssoweknowt>=1here.*/
    t=length/wsize;
    do{
    *(u_int*)dst=WIDEVAL;
    dst+=wsize;
    }while(--t!=0);

    /*Mopuptrailingbytes,ifany.*/
    t=length&wmask;
    if(t!=0)
    do{
    *dst++=VAL;
    }while(--t!=0);
    return(dst0);
    }

    /***
    $Log: memset_8c.xml,v $
    Revision 1.6  2006/12/19 14:12:52  reddawg
    rtld-elf almost workign

    Revision1.1.1.12006/06/0112:46:16reddawg
    ubix2

    Revision1.22005/10/1200:13:37reddawg
    Removed

    Revision1.1.1.12005/09/2617:24:12reddawg
    nomessage

    Revision1.12004/07/2816:20:10reddawg
    forgotthisfile

    END
    ***/