aboutsummaryrefslogtreecommitdiff
path: root/source/Utils.hpp
blob: 03fdfed39d8218bf39377f85a06398b80febcd30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#pragma once

#include <cstdio>
#include <filesystem>

namespace Utils {

enum IoMode {
	Read,
	WriteTruncate,
	WriteAppend,
};

FILE* OpenCstdioFile(const std::filesystem::path& path, IoMode mode, bool binary = false);
FILE* OpenCstdioFile(const char* path, IoMode mode, bool binary = false);

constexpr float Abs(float v) noexcept {
	return v < 0.0f ? -v : v;
}

} // namespace Utils