Skip to content

Instantly share code, notes, and snippets.

Roger Ferrer Ibáñez rofirrim

View GitHub Profile
View gist:0f2e04a715ea93c9cef05dbff3c39906
AQ (Antarctica) -> QA (Qatar)
AU (Australia) -> UA (Ukraine)
BG (Bulgaria) -> GB (United Kingdom)
BL (St. Barthélemy) -> LB (Lebanon)
BS (Bahamas) -> SB (Solomon Islands)
CA (Canada) -> AC (Ascension Island)
CI (Côte d'Ivoire) -> IC (Canary Islands)
CL (Chile) -> LC (St. Lucia)
CV (Cape Verde) -> VC (St. Vincent & Grenadines)
EA (Ceuta & Melilla) -> AE (United Arab Emirates)
@rofirrim
rofirrim / recmap.cc
Created Aug 5, 2018
Recmap Tentative Idea
View recmap.cc
#include <unordered_map>
struct RecMap
{
using Map = std::unordered_map<int, RecMap*>;
Map M;
};
int main(int argc, char* argv[])
{
View iwyuc.sh
#!/bin/bash
TOOL="$1"
MY_PATH=$(dirname $(realpath $0))
IWYUC_FLAGS="\
-Xiwyu --no_comments \
-isystem /home/roger/soft/llvm-4.0/install/bin/../lib/clang/4.0.0/include/ \
-isystem /usr/lib/gcc/x86_64-linux-gnu/6/include"
View build-flang.sh
#!/bin/bash -ex
export STAGEDIR=$(pwd)
export INSTALLDIR=$(pwd)/install
export BUILDDIR=$(pwd)/build
export BUILDFLANGDIR=$(pwd)/build-flang
mkdir -p ${BUILDDIR}
mkdir -p ${BUILDFLANGDIR}
View serp.asm
.model large
.386
; Constants per comoditat
CERT equ 0FFh
FALS equ 00h
; Convencio de valors del sentit
View gist:ff94801715157d541199
#ifndef Q_NUMBERS_HPP
#define Q_NUMBERS_HPP
// Simple implementation of Q numbers
// There may be bugs. Use at your own risk
/*
See https://en.wikipedia.org/wiki/Q_%28number_format%29
*/
@rofirrim
rofirrim / gist:7358592
Created Nov 7, 2013
Intel Fortran does not compile this :(
View gist:7358592
MODULE a
IMPLICIT NONE
INTEGER(4), PUBLIC :: x1
INTEGER(4), PUBLIC :: x2
END MODULE a
MODULE a2
IMPLICIT NONE
INTEGER(4), PUBLIC :: x1
INTEGER(4), PUBLIC :: x2
View gist:6088016
#include <iostream>
#include <assert.h>
#include <math.h>
__global__ void f(float sum, int B, float *z, float *z2)
{
*z = sum / B;
*z2 = sum / (float)B;
}
@rofirrim
rofirrim / gist:5441275
Last active Dec 16, 2015
Another C++ rant
View gist:5441275
template <typename T>
struct f // This is ::f
{
};
namespace B
{
template <typename T>
struct f // This is B::f
{
@rofirrim
rofirrim / test.c
Created Jan 30, 2013
Intel C/C++ 12.0.4 generates wrong code and the assertion fails. Intel C/C++ 11 generates correct code.
View test.c
#include <stdio.h>
#include <assert.h>
int c[4+3][3*2];
void f(int * const n, int * const m, int (**v)[*m * 2])
{
assert(&(c[*n][*m]) == &((*v)[*n][*m]));
}
You can’t perform that action at this time.