Skip to content

Instantly share code, notes, and snippets.

View praisethemoon's full-sized avatar
🌕

moon praisethemoon

🌕
View GitHub Profile
@praisethemoon
praisethemoon / Search.py
Created September 11, 2018 17:07
ThirstyShoddyLanservers-2 created by praisethemoon - https://repl.it/@praisethemoon/ThirstyShoddyLanservers-2
"""
Prints the nodes queue,
please note that the queue is actually a stack, sorted reversely.
Elements are extracted using `pop()` for ease of implementation which
is relatively the same as using a real queue and removing this first element,
Except that the first approach takes only one instruction.
"""
def printQueue(queue):
counter = len(queue)
@praisethemoon
praisethemoon / main.c
Created February 4, 2018 16:07
SSE vs Native Loop over FLOAT
#include <xmmintrin.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
void __attribute__ ((noinline)) SSE(){
int len = 1024;
float data1 [1024] = {1, 2, 3, 4, 5, 6, 7, 8};
float data2 [1024] = {1, 2, 3, 4, 5, 6, 7, 8};
float dest[1024];
@praisethemoon
praisethemoon / BinaryConvert.c
Last active May 2, 2017 16:37
Convert Integer to binary
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#define bin(name, t) void name(t n, uint8_t* dest) { \
size_t size = sizeof(t) * 8;\
t counter = 0;\
while(n){\
if(n & 1) \
dest[counter] = '1';\