10 #pragma GCC diagnostic push
11 #pragma GCC diagnostic ignored "-Wreturn-type"
35 ::
"b"(0),
"S"(str1),
"D"(str2));
47 " cmp BYTE ptr [si+bx], 0\n"
52 " mov eax, ebx"::
"b"(0),
"S"(str));
55 #pragma GCC diagnostic pop
64 const char *
strchr (
const char * str,
int character ) {
73 const uint32_t pows[] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000};
80 int stoi(
const char *str) {
82 size_t size =
strlen(str) - 1;
83 for(
size_t i = (str[0] ==
'-' ? 1 : 0); str[i] != 0; i++)
84 num += pows[size - i] * (str[i] -
'0');
86 return (str[0] ==
'-') ? -num : num;
97 int memset(
int ptr,
int value,
size_t count) {
102 ::
"b"(ptr),
"c"(count),
"d"(value));
113 char *
strcpy (
char * destination,
const char * source ) {
117 destination[i] = source[i];
119 }
while(source[i - 1] != 0);
131 int strncpy (
int destination,
int source,
size_t num ) {
133 " mov al, byte ptr [si+bx]\n"
134 " mov byte ptr [di+bx], al\n"
140 ::
"D"(destination),
"S"(source),
"b"(0),
"c"(num));
size_t strlen(const char *str)
Returns length of string.
int strncpy(int destination, int source, size_t num)
Copy num Bytes from source to destination until \0 appears.
bool strcmp(int str1, int str2)
Compares two string until \0 appears.
int stoi(const char *str)
Convert string to int.
int memset(int ptr, int value, size_t count)
Set count Bytes of *ptr to value.
char * strcpy(char *destination, const char *source)
Copy from source to destination until \0 appears.
const char * strchr(const char *str, int character)
Find first appearance of character.
useful macros, definitions, enums etc.
#define NULL
pointer to NULL