hostsupport/hostopenvg/src/src/riUtils.h
branchbug235_bringup_0
changeset 53 c2ef9095503a
parent 24 a3f46bb01be2
equal deleted inserted replaced
52:39e5f73667ba 53:c2ef9095503a
       
     1 /* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     2  *
       
     3  * Permission is hereby granted, free of charge, to any person obtaining a
       
     4  * copy of this software and /or associated documentation files
       
     5  * (the "Materials "), to deal in the Materials without restriction,
       
     6  * including without limitation the rights to use, copy, modify, merge,
       
     7  * publish, distribute, sublicense, and/or sell copies of the Materials,
       
     8  * and to permit persons to whom the Materials are furnished to do so,
       
     9  * subject to the following conditions:
       
    10  *
       
    11  * The above copyright notice and this permission notice shall be included
       
    12  * in all copies or substantial portions of the Materials.
       
    13  *
       
    14  * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
       
    15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
       
    16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
       
    17  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
       
    18  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
       
    19  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
       
    20  * THE USE OR OTHER DEALINGS IN THE MATERIALS.
       
    21  */
       
    22 
       
    23 #ifndef __RIUTILS_H_
       
    24 #define __RIUTILS_H_
       
    25 
       
    26 #ifndef __RIDEFS_H
       
    27 #   include "riDefs.h"
       
    28 #endif
       
    29 
       
    30 #include "VG/openvg.h"
       
    31 #include <string.h>
       
    32 
       
    33 // This file contains "utility" functions that did not "fit" into existing RI files.
       
    34 // Once more functionality is accumulated, the corresponding functions/classes should be
       
    35 // moved to proper files asap. For example, the memcopy functions could go into file
       
    36 // "riMemory.xxx".
       
    37 
       
    38 namespace OpenVGRI
       
    39 {
       
    40 
       
    41             void    riMemSet32(void* dst, RIuint32 c, size_t nElements, size_t nBytesPerElement);
       
    42 RI_INLINE   void    ri_memcpy(void* dst, const void* src, size_t n);
       
    43             int     riInsertBits32(RIuint32* hash, size_t hashSize, RIuint32 bits, RIuint32 bitSize, int bitPtr);
       
    44             int     riVGImageFormatToIndex(VGImageFormat format);
       
    45 
       
    46 RI_INLINE void ri_memcpy(void* dst, const void* src, size_t n)
       
    47 {
       
    48 #if !defined(RI_DEBUG)
       
    49     memcpy(dst, src, n);
       
    50 #else
       
    51     RIuint8 *p = (RIuint8*)dst;
       
    52     RIuint8 *q = (RIuint8*)src;
       
    53     for (size_t i = 0; i < n; i++, p++, q++)
       
    54     {
       
    55         *p = *q;
       
    56     }
       
    57 #endif
       
    58 }
       
    59 
       
    60 } // namespace OpenVG
       
    61 
       
    62 #endif
       
    63