This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <array> | |
#include <cstdint> | |
#include <iostream> | |
#include <stdexcept> | |
using namespace std; | |
template <unsigned long long n> | |
constexpr auto count_set_bits = (n & 1) + count_set_bits<(n >> 1)>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
template <unsigned long long N, char... C> | |
constexpr auto to_bin = to_bin<(N >> 1), '0' + (N & 1), C...>; | |
template <char... C> | |
constexpr char to_bin<0, C...>[] = { C..., '\0' }; | |
template <unsigned long long N, size_t L, char... C> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <iostream> | |
#include <vector> | |
#include <boost/asio/coroutine.hpp> | |
#include <boost/asio/yield.hpp> | |
using namespace std; | |
using namespace boost::asio; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
constexpr auto all(auto&&... args) { | |
return (args && ...); | |
} | |
int main() { | |
cout << boolalpha; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AsmTest { | |
public static native int addThem(int a, int b); | |
static { | |
// Looks for libaddThem.so or addThem.dll, depending on the OS | |
System.loadLibrary("addThem"); | |
} | |
public static void main(String[] args) { | |
int result = addThem(4, 5); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Just for fun. | |
; Compile with | |
; nasm -f elf32 -o arp.o arp.asm | |
; gcc -m32 -o arp arp.o | |
; Run it | |
; sudo ./arp | |
BITS 32 | |
SEGMENT .data |
NewerOlder