Skip to content

Instantly share code, notes, and snippets.

View tomsmeding's full-sized avatar
🦆

Tom Smeding tomsmeding

🦆
View GitHub Profile
module Main where
import Submod
main :: IO ()
main = return ()

For people who wonder even more about taking the maximum of two floats: let's compare fmax(a,b), fmaxf(a,b), std::max(a,b) and if (a < b) return b; else return a; in gcc, clang, icc and msvc.

Look at the assembler outputs here: gcc and clang (https://godbolt.org/z/a1pb5N), icc and mscv (https://godbolt.org/z/FoH15I).

Results:

. | CLANG | GCC | ICC | MSVC

#include <cstdio>
#include <thread>
#include <vector>
#include <algorithm>
#include <atomic>
using namespace std;
template <typename T>
@tomsmeding
tomsmeding / gist:ff4e77f181ff6d87c5bcf03531701435
Last active October 3, 2018 12:30
gcc bug priority_queue multiple files same struct name
$ valgrind ./ab
==13981== Memcheck, a memory error detector
==13981== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==13981== Using Valgrind-3.14.0.GIT and LibVEX; rerun with -h for copyright info
==13981== Command: ./ab
==13981==
==13981==
==13981== HEAP SUMMARY:
==13981== in use at exit: 0 bytes in 0 blocks
==13981== total heap usage: 2 allocs, 2 frees, 72,708 bytes allocated
/// -------------------- STANDARD LIBRARY THINGS --------------------
#include <stdbool.h>
#define WASM_EXPORT __attribute__((visibility("default")))
typedef unsigned char uint8_t;
typedef unsigned int uint32_t;
typedef unsigned long long int uint64_t;
@tomsmeding
tomsmeding / Makefile
Last active August 28, 2018 14:16
Hotpatcher for my Art Attack WASM bots. (https://codegolf.stackexchange.com/a/171243/6689)
CXX = g++
CXXFLAGS = -Wall -Wextra -std=c++11 -O2 -fwrapv -g
TARGET = hotpatcher
.PHONY: all clean
all: $(TARGET)
clean:
rm -r $(TARGET) *.o
#!/usr/bin/env python
# coding=utf-8
import weechat,os
weechat.register("sneeuwpop","Tom Smeding","0.1","MIT","sneeuwpop helper","","")
def send_sneeuwpop(data,buf,args):
return weechat.command(buf,u"/say ⛄️".encode("utf-8"))
def send_sneeuwpop_ascii(data,buf,args):
@tomsmeding
tomsmeding / gist:f4bbc6e86f308005f025faf22b70cfd8
Last active May 28, 2017 12:03
Symmetry reduction in O&C
#define HASH_SIZE 1048573
struct hash_item{
bd_t bd;
int alpha,beta;
int score;
};
struct hash_item hashtable[HASH_SIZE];
static int hash_func(bd_t bd){
return (bd[0]^(bd[1]<<5))%HASH_SIZE;
java.lang.NullPointerException
at com.nvidia.viper.ui.analysis.GuidedAnalysisComposite$4.propertyChange(GuidedAnalysisComposite.java:409)
at com.nvidia.viper.model.ModelWithProperties.firePropertyChange(ModelWithProperties.java:128)
at com.nvidia.viper.model.ExpertSystem.propertyChange(ExpertSystem.java:302)
at com.nvidia.viper.model.ModelWithProperties.firePropertyChange(ModelWithProperties.java:128)
at com.nvidia.viper.model.Session$5.propertyChange(Session.java:1136)
at com.nvidia.viper.model.ModelWithProperties.firePropertyChange(ModelWithProperties.java:128)
at com.nvidia.viper.model.Analysis.setSelectedStage(Analysis.java:380)
at com.nvidia.viper.editor.InstructionExecutionViewerControl.selectAnalysisStage(InstructionExecutionViewerControl.java:459)
at com.nvidia.viper.editor.SourceSassEditor$1.handleNewActivePart(SourceSassEditor.java:225)
diff --git a/.gitignore b/.gitignore
index d964878..0a245bb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
*.o
*.dSYM
-main
+editor
editor.log