Skip to content

Instantly share code, notes, and snippets.

@Cleroth
Cleroth / lfsr.c
Created February 23, 2023 10:57 — forked from BobBurns/lfsr.c
Linear feed shift register in C with 8 bits
#include <stdio.h>
#include <stdlib.h>
#define STREAM (256 * 8)
/* short program to understand linear feed shift register
* and its use in stream ciphers.
*/
int
template <typename T>
struct OutArg {
T * operator ->() const
{
return &_t;
}
T & operator*() const
{
return _t;
@Cleroth
Cleroth / vswarnings.h
Created August 16, 2018 11:26
VS warnings
// level 1
#pragma warning (default : 4546) // function call before comma missing argument list
#pragma warning (default : 4547) // operator before comma has no effect; expected operator with side-effect
#pragma warning (default : 4548) // expression before comma has no effect; expected expression with side-effect
#pragma warning (default : 4549) // operator before comma has no effect; did you intend 'operator'?
#pragma warning (default : 4555) // expression has no effect; expected expression with side-effect
#pragma warning (default : 4906) // string literal cast to 'LPWSTR'
#pragma warning (default : 4946) // Do not use reinterpret_cast to cast between related types. Use static_cast instead, or for polymorphic types, use dynamic_cast.
// level 4
//#pragma warning (default : 4242) // conversion from 'type1' to 'type2', possible loss of data
namespace detail
{
template <typename Res = void, typename ... Args>
class Lambda {
public:
virtual Res operator()(Args ... args) = 0;
virtual ~Lambda() noexcept = default;
};
template <typename T, typename Res, typename ... Args>
#pragma once
// -------------------------- USAGE INFO ----------------------------
/*
// T.h:
class T {
private:
OBJECT_TRACKER(T);
};
const auto & font = app->_fonts[0];
auto prev_view = tgt->getView();
// GetPos() gets the unit's world position (shape world position for you)
auto world_pos = GetPos();
world_pos.y -= 11 + font.size;
auto screen_pos = tgt->mapCoordsToPixel(world_pos);