Helixis 1.0
Task Programming API
Functions
sources/builtins.c File Reference
#include "hlx/core.h"
#include "helixis_internal.h"

Go to the source code of this file.

Functions

unsigned long hlx_hash (const char *str)
void * hlx_memcpy (void *dest, const void *src, unsigned int num)

Function Documentation

unsigned long hlx_hash ( const char *  str)

Compute an hash code with the given string

Parameters:
strThe string.
See also:
hlx_event_handler_create()
hlx_chan_create()
Returns:
The hash code.

Definition at line 43 of file builtins.c.

{
        unsigned long   hash;
        int                             c;

        hash = 5361;
        while (*str)
        {
                c = *str;
                hash = (hash << 5) + hash + c;
                ++str;
        }
        return (hash);
}
void* hlx_memcpy ( void *  dest,
const void *  src,
unsigned int  num 
)

Definition at line 58 of file builtins.c.

Referenced by hlx_core_init().

{
        char* dst8 = (char*)dest;
        char* src8 = (char*)src;

        if (num & 1)
        {
                dst8[0] = src8[0];
                dst8 += 1;
                src8 += 1;
        }
        num /= 2;
        while (num--)
        {
                dst8[0] = src8[0];
                dst8[1] = src8[1];
                dst8 += 2;
                src8 += 2;
        }
        return (dest);
}
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines