/* Copyright 2022 Gabriel Jensen This file is part of rgo. rgo is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. rgo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with rgo. If not, see . */ #if !defined(__x86_64__) && !defined(__i386__) #error Unsupported machine architecture! Supported: Aarch64, AMD64, IA-32; #endif #if !defined(rgo_ver) #if defined(__ASSEMBLER__) #define rgo_ver $0x6 #else #define rgo_ver (0x6) #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 #include #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 [[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(::__rgo_memdup(_ptr,_num));} #else #define rgo_memdup __rgo_memdup #endif #endif #endif