Ignore:
Timestamp:
Jul 22, 2012, 12:06:11 PM (12 years ago)
Author:
karaoui
Message:

updating libs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/libs/common.h

    r176 r178  
    11//////////////////////////////////////////////////////////////////////////////////
    2 // File     : common.h         
    3 // Date     : 20/07/2012
    4 // Author   : mohamed karaoui
     2// File         : common.h         
     3// Date         : 20/07/2012
     4// Maintener    : mohamed karaoui
    55// Copyright (c) UPMC-LIP6
    66///////////////////////////////////////////////////////////////////////////////////
     
    88#ifndef _COMMON_H_
    99#define _COMMON_H_
     10
     11/*
     12 * memcpy, memset function
     13 * This function is required because it can be gnerated by GCC
     14 * during compilation so we must provide it.
     15 * Code taken from MutekH.
     16 */
     17//////////////////////////////////////////////////////////////////////////
     18static inline void *memcpy(void *_dst, const void *_src, unsigned int size)
     19{
     20    unsigned int *dst = _dst;
     21    const unsigned int *src = _src;
     22
     23    /* if source and destination buffer are word-aligned,
     24     * then copy word-by-word */
     25    if (!((unsigned int)dst & 3) && !((unsigned int)src & 3))
     26        while (size > 3) {
     27            *dst++ = *src++;
     28            size -= 4;
     29        }
     30
     31    unsigned char *cdst = (unsigned char*)dst;
     32    unsigned char *csrc = (unsigned char*)src;
     33
     34    /* byte-by-byte copy */
     35    while (size--) {
     36        *cdst++ = *csrc++;
     37    }
     38    return _dst;
     39}
     40
     41//////////////////////////////////////////////////////////
     42static inline void * memset(void *dst, int s, unsigned int count)
     43{
     44        char *a = (char *) dst;
     45        while (count--)
     46                *a++ = (char)s;
     47        return dst;
     48}
    1049
    1150/**
     
    2665   Taken from Mutekh(SRL API)
    2766 */
    28 
    2967static inline void __abort()
    3068{
     
    3371}
    3472
    35 ////////////////////////////////////////////////////////////////////////////////////////
    36 //  mempcy()
    37 // GCC may requires this function. Taken from MutekH.
    38 ////////////////////////////////////////////////////////////////////////////////////////
    39 void *memcpy(void *_dst, const void *_src, unsigned int size);
    40 
    41 ////////////////////////////////////////////////////////////////////////////////////////
    42 //  memset()
    43 // GCC may requires this function. Taken from MutekH.
    44 ////////////////////////////////////////////////////////////////////////////////////////
    45 inline void * memset(void *dst, int s, unsigned int count);
    46 
    4773#endif /* _COMMON_H_ */
Note: See TracChangeset for help on using the changeset viewer.