diff options
Diffstat (limited to 'rgo/include')
-rw-r--r-- | rgo/include/rgo.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/rgo/include/rgo.h b/rgo/include/rgo.h new file mode 100644 index 0000000..1d76281 --- /dev/null +++ b/rgo/include/rgo.h @@ -0,0 +1,55 @@ +/* + 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 <https://www.gnu.org/licenses/>. +*/ + +#if !defined(rgo_hdr) +#define rgo_hdr + +#if defined(__ASSEMBLER__) +.extern rgo_memcmp +.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_fndchr( char const * __restrict__ str, char chr); +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)) int8_t rgo_memcmp( void const * __restrict__ lptr,size_t num,void const * __restrict__ rptr); +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__ str); +rgo_priv_externc __attribute__((hot,malloc,nothrow)) char * rgo_strdup( char const * __restrict__ str); +rgo_priv_externc __attribute__((hot,nothrow)) size_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
\ No newline at end of file |