imma stop using size_t
This commit is contained in:
@@ -4,9 +4,8 @@
|
||||
#include <vector>
|
||||
#include <filesystem>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
namespace ircolib {
|
||||
namespace fs = std::filesystem;
|
||||
static inline std::vector<u8> read_file_binary(const std::string &path) {
|
||||
std::ifstream file(path, std::ios::binary);
|
||||
return {std::istreambuf_iterator{file}, {}};
|
||||
@@ -17,19 +16,19 @@ static inline void write_file_binary(const std::vector<u8> &data, const std::str
|
||||
std::copy(data.begin(), data.end(), std::ostreambuf_iterator{file});
|
||||
}
|
||||
|
||||
static inline void write_file_binary(const u8 *data, const size_t size, const std::string &path) {
|
||||
static inline void write_file_binary(const u8 *data, const u32 size, const std::string &path) {
|
||||
FILE *out = fopen(path.c_str(), "wb");
|
||||
fwrite(data, size, 1, out);
|
||||
fclose(out);
|
||||
}
|
||||
|
||||
template <size_t Size>
|
||||
template <u32 Size>
|
||||
static inline void write_file_binary(const std::array<u8, Size> &data, const std::string &path) {
|
||||
std::ofstream file(path, std::ios::binary);
|
||||
std::copy(data.begin(), data.end(), std::ostreambuf_iterator{file});
|
||||
}
|
||||
|
||||
static inline size_t next_pow2(size_t num) {
|
||||
static inline u32 next_pow2(u32 num) {
|
||||
// Taken from "Bit Twiddling Hacks" by Sean Anderson:
|
||||
// https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
|
||||
--num;
|
||||
|
||||
Reference in New Issue
Block a user