Skip to content

Instantly share code, notes, and snippets.

View NewbiZ's full-sized avatar
😎

Aurélien Vallée NewbiZ

😎
View GitHub Profile
@NewbiZ
NewbiZ / now.cpp
Last active May 18, 2019 19:58
Current time string C++
#include <string>
#include <ctime>
std::string now()
{
std::time_t tt = std::time(NULL);
std::string s = std::ctime(&tt);
return s.substr(0, s.size()-1);
}
@NewbiZ
NewbiZ / gist:5541524
Last active December 10, 2021 20:46
Just a snippet to swap red and blue in a BGRA buffer, to get a RGBA buffer (useful when loading TGA).
#ifdef __SSSE3__
# include <xmmintrin.h>
# include <tmmintrin.h>
#endif
posix_memalign((void**)&pixels, 16, sizeof(unsigned int)*PIXEL_COUNT);
/*
* Mind this will only work for width * height % 16 == 0 textures