summaryrefslogblamecommitdiff
path: root/rgo/include/rgo.h
blob: ff3c127149863c5a2645c9786f721c28da89112c (plain) (tree)
1
2
3
4
5
6
7
8
9
10
  


                                                                                                                    

  
                                              
                  

      

                          
                    
     
                     
      

                          

                   

















                                                                                                                                                        
                                                                                                                                                                                       
                                                                                                                                                        


                                                                                                                                                                                       
                                                                                                                                                         
                                                                                                                         
                                                                                                                                                         









                                                                                                                                                                                                               
      
/*
	Copyright 2022 Gabriel Jensen.
	This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
	If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

#if !defined(__x86_64__) && !defined(__i386__)
#define rgo_noimpl
#endif

#if !defined(rgo_ver)
#if defined(__ASSEMBLER__)
#define rgo_ver $0x7
#else
#define rgo_ver (0x7)
#endif

#if defined(__ASSEMBLER__)
.extern rgo_fndbyte
.extern rgo_fndchr
.extern rgo_memcpy
.extern rgo_memeq
.extern rgo_memfill
.extern rgo_strcpy
.extern rgo_streq
.extern rgo_strfill
.extern rgo_strlen
#else
#include <stddef.h>
#include <stdint.h>

#if defined(__cplusplus)
#define rgo_priv_externc extern "C"
#else
#define rgo_priv_externc
#endif

rgo_priv_externc __attribute__((alloc_size(0x2),hot,malloc,nothrow)) void *  __rgo_memdup(void const * __restrict__ ptr, size_t                    num);
rgo_priv_externc __attribute__((hot,nothrow))                        size_t  rgo_fndbyte( void const * __restrict__ ptr, size_t                    num,uint8_t                   byte);
rgo_priv_externc __attribute__((hot,nothrow))                        size_t  rgo_fndchr(  char const * __restrict__ str, char                      chr);
rgo_priv_externc __attribute__((hot,nothrow))                        void    rgo_memcpy(  void const * __restrict__ in,  size_t                    num,void *       __restrict__ out);
rgo_priv_externc __attribute__((hot,nothrow))                        uint8_t rgo_memeq(   void const * __restrict__ lptr,size_t                    num,void const * __restrict__ rptr);
rgo_priv_externc __attribute__((hot,nothrow))                        void    rgo_memfill( void const * __restrict__ ptr, size_t                    num,uint8_t                   val);
rgo_priv_externc __attribute__((hot,nothrow))                        size_t  rgo_strcpy(  char const * __restrict__ lstr,char const * __restrict__ rstr);
rgo_priv_externc __attribute__((hot,malloc,nothrow))                 char *  rgo_strdup(  char const * __restrict__ str);
rgo_priv_externc __attribute__((hot,nothrow))                        uint8_t rgo_streq(   char const * __restrict__ lstr,char const * __restrict__ rstr);
rgo_priv_externc __attribute__((hot,nothrow))                        void    rgo_strfill( char const * __restrict__ lstr,char                      chr);
rgo_priv_externc __attribute__((hot,nothrow))                        size_t  rgo_strlen(  char const * __restrict__ str);

#if defined(__cplusplus)
template<typename T> [[gnu::alloc_size(0x2),gnu::hot,gnu::malloc]] auto rgo_memdup(T const * __restrict__ const _ptr,::size_t const _num) noexcept -> T * {return static_cast<T *>(::__rgo_memdup(_ptr,_num));}
#else
#define rgo_memdup __rgo_memdup
#endif
#endif

#endif