2015-05-04 15:32:23 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2015-05-11 03:08:32 -04:00
|
|
|
typedef uint8_t u8;
|
|
|
|
typedef uint16_t u16;
|
|
|
|
typedef uint32_t u32;
|
|
|
|
typedef uint64_t u64;
|
2015-05-04 15:32:23 -07:00
|
|
|
|
2015-05-11 03:08:32 -04:00
|
|
|
typedef int8_t s8;
|
|
|
|
typedef int16_t s16;
|
|
|
|
typedef int32_t s32;
|
|
|
|
typedef int64_t s64;
|
2015-05-04 15:32:23 -07:00
|
|
|
|
2015-05-11 03:08:32 -04:00
|
|
|
typedef volatile u8 vu8;
|
|
|
|
typedef volatile u16 vu16;
|
|
|
|
typedef volatile u32 vu32;
|
|
|
|
typedef volatile u64 vu64;
|
2015-05-04 15:32:23 -07:00
|
|
|
|
|
|
|
inline char* strupper(const char* str) {
|
2015-05-11 03:14:07 -04:00
|
|
|
const size_t string_len = strlen(str);
|
|
|
|
char* buffer = (char*)malloc(string_len + 1);
|
|
|
|
|
|
|
|
for (int i = 0; i < string_len; ++i)
|
2015-05-04 15:32:23 -07:00
|
|
|
buffer[i] = toupper((unsigned)str[i]);
|
2015-05-11 03:14:07 -04:00
|
|
|
|
2015-05-04 15:32:23 -07:00
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline char* strlower(const char* str) {
|
2015-05-11 03:14:07 -04:00
|
|
|
const size_t string_len = strlen(str);
|
|
|
|
char* buffer = (char*)malloc(string_len + 1);
|
|
|
|
|
|
|
|
for (int i = 0; i < string_len; ++i)
|
2015-05-04 15:32:23 -07:00
|
|
|
buffer[i] = tolower((unsigned)str[i]);
|
2015-05-11 03:14:07 -04:00
|
|
|
|
2015-05-04 15:32:23 -07:00
|
|
|
return buffer;
|
2015-05-10 01:00:50 -07:00
|
|
|
}
|