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
#ifndef OH_GENERATE_VECTORS_PY_H | |
#define OH_GENERATE_VECTORS_PY_H | |
#pragma warning(disable: 4201) | |
union u8t2 { | |
struct { u8t x; u8t y; }; | |
struct { u8t u; u8t v; }; | |
u8t E[2]; | |
}; | |
union u8t3 { |
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
# Usage: py -3 ./oh_generate_vectors.py [header filename] [header guard name] | |
# eg py -3 ./oh_generate_vectors.py oh_generate_vectors.py.h OH_GENERATE_VECTORS_PY_H | |
from collections import namedtuple | |
from itertools import chain, product | |
from contextlib import contextmanager | |
import re | |
import sys | |
Prim = namedtuple('prim', |
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
#define IMPL_DIV_INT(_intT) \ | |
inline _intT Div(_intT A, _intT B) { \ | |
_intT q = A/B, r = A%B; \ | |
if ((r > 0 && B < 0) || (r < 0 && B > 0)) { return q-1; } \ | |
return q; \ | |
} | |
#define IMPL_CEIL_DIV_INT(_intT) \ | |
inline _intT CeilDiv(_intT A, _intT B) { \ | |
_intT q = A/B, r = A%B; \ |
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
// This doesn't seem to work properly | |
//#define USE_UNITY_PIN_FUNCTION | |
using System; | |
using System.Runtime.InteropServices; | |
using System.Threading; | |
using Unity.Collections; | |
using Unity.Collections.LowLevel.Unsafe; | |
using Unity.Jobs; | |
using UnityEngine; | |
using UnityEngine.Assertions; |
This file has been truncated, but you can view the full file.
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
/* GIMP header image file format (INDEXED): C:\Users\co.nl.on\Desktop\desktop dump 2018\gimp_img_idxd.h */ | |
static unsigned int width = 500; | |
static unsigned int height = 482; | |
/* Call this macro repeatedly. After each use, the pixel data can be extracted */ | |
#define HEADER_PIXEL(data,pixel) {\ | |
pixel[0] = header_data_cmap[(unsigned char)data[0]][0]; \ | |
pixel[1] = header_data_cmap[(unsigned char)data[0]][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
namespace OHDelegate | |
{ | |
/*<<< | |
for valCnt in range(0, 6): | |
for refCnt in range(1, 9 - valCnt): | |
suffix = "WithRef" if refCnt == 1 else "With#{refCnt}Refs" | |
typeParams = ["in TVal#{i}" for i in xrange(0, valCnt)] + ["TRef#{i}" for i in xrange(0, refCnt)] | |
angleBracketContents = ", ".join(typeParams) | |
params = ", ".join(["TVal#{i} v#{i}" for i in xrange(0, valCnt)] + ["ref TRef#{i} r#{i}" for i in xrange(0, refCnt)]) | |
OUT("public delegate void Action#{suffix}<#{angleBracketContents}>(") |
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
// This doesn't seem to work properly | |
//#define USE_UNITY_PIN_FUNCTION | |
using System; | |
using System.Runtime.InteropServices; | |
using Unity.Collections; | |
using Unity.Collections.LowLevel.Unsafe; | |
using UnityEngine; | |
using UnityEngine.Assertions; | |
// Trick for creating a temporary NativeArray which points to the contents of a managed array. |
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 <stdlib.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <time.h> | |
#include <string.h> | |
struct lbp_serializer | |
{ | |
int32_t DataVersion; | |
FILE* FilePtr; |
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
using UnityEngine; | |
namespace OH.Ext | |
{ | |
public static class OHVectorToUnityIntVector | |
{ | |
public static Vector2Int ToVector2Int(this VectorI2 v) | |
{ | |
return new Vector2Int(v.x, v.y); | |
} |
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
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
// Ill-advised experiment making a SoA container in C# using Reflection | |
namespace SoaExperiment |
NewerOlder