/******************************************************************************/
/* SlunkCrypt, by LoRd_MuldeR <MuldeR2@GMX.de>                                */
/* This work has been released under the CC0 1.0 Universal license!           */
/******************************************************************************/

#ifndef INC_UTILS_H
#define INC_UTILS_H

#include "platform.h"
#include <stdint.h>

typedef void (signal_handler_t)(int);

void init_terminal(void);
void setup_signal_handler(const int signo, signal_handler_t* const handler);
uint64_t swap_bytes_u64(const uint64_t value);
char* CHR_to_utf8(const CHR *const input);
uint64_t get_file_size(FILE* const file);
const CHR *get_file_name(const CHR *path);

#define GET_NIBBLE(X) ((X) & 0x0F)
#define SET_NIBBLE(X, Y) do { X = ((X) & 0xF0) | ((Y) & 0x0F); } while(0)

#endif