Skip to content

Instantly share code, notes, and snippets.

View d3x0r's full-sized avatar

Jim B d3x0r

  • Las Vegas
View GitHub Profile
@d3x0r
d3x0r / test.c
Last active May 18, 2020 00:50
Trust in the Optimizer ???
// test available here
// https://godbolt.org/z/EiXxwW
// This is the basic function
int upTree( int N ) {
int n;
for( n = 0; n < 32; n++ ) if( !(N&(1<<n)) ) break;
return (N & ~((0x1)<<(n+1))) | ( 0x01 << n );
}
@d3x0r
d3x0r / about.md
Last active May 10, 2020 08:55
Get the preferred folding direction for a quad; assuming 'best' is 'contains most inner space'

Determining the fold direction of a quadrilateral.

Fold Comparison

This function calculat(ed) the lengths of the diagonals of the quad p1 -> p3 and p2 -> p4, and resulted with a fold on the shortest of the diagonals. That works in some cases.

The function now calculates the nearest points on the two crossing lines of the quad and picks the line furthest along the normal passed in; this might be called 'the choice enclosing the most area'. The other

@d3x0r
d3x0r / Area-Perimeter-Edge-Ratios.jpg
Last active May 2, 2020 00:33
Compares triangle area vs perimeter
Area-Perimeter-Edge-Ratios.jpg
@d3x0r
d3x0r / sineWave.md
Created April 24, 2020 14:45
temp dump
Sine Waves: [ 130, 130, 130 ]
Adding this for a new raycaster?
Has Content? true
First mip children have  11111111

---------- Dumping Oct Level  1  at  0 depth: 8 size: 2
1111~1111 0101~0101 
0011~0011 0001~0001 
---------------------
@d3x0r
d3x0r / CardUtils.js
Last active April 9, 2020 05:27
Utility to convert binary array buffer to usable card information.
// buffer is an array buffer, this routine will apply a Uint8Array to it.
// numbers is the numbers of the game (0 or 75 is 75, or 90 number which is different)
// call with '75'
function MakeCardFromBuffer( buffer, numbers ) {
buffer = new Uint8Array(buffer);
//console.log( "Length...", buffer.byteLength, buffer[0] );
if( buffer.byteLength == 12 ) {
if( !numbers || numbers === 75 ) {
var card = [[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]];
@d3x0r
d3x0r / Marching-tets.md
Last active January 5, 2024 08:10
Marching tetrahedrons; Marching Diamond Crystal Lattice; Marching Cubes/Sliced into 5 Tetrahedrons
@d3x0r
d3x0r / C.dot.arrow.md
Last active April 2, 2023 03:41
A proposal for extending C to allow `.` operator to perform indirection of a pointer.

See C++ Proposal

Document number Nnnnn=yy-nnnn
Date: yyyy-mm-dd
Project WG14 - Programming Language C Working Group(?)
Reply-to d3x0r < d3ck0r at gmail >

I. Table of Contents

@d3x0r
d3x0r / C-Number-underscore.md
Last active March 5, 2020 04:31
C Proposal - Allow underscores in numbers
Document number Nnnnn=yy-nnnn
Date: yyyy-mm-dd
Project Programming Language C++, Library Working Group
Reply-to this document

I. Table of Contents

@d3x0r
d3x0r / C-string-proposal.md
Last active March 5, 2020 00:13
Proposal - Generlize quoted string handling
Document number Nnnnn=yy-nnnn
Date: yyyy-mm-dd
Project Programming Language C++, Library Working Group
Reply-to this document

I. Table of Contents

@d3x0r
d3x0r / README.md
Last active June 1, 2020 09:55
Uniform length bit mask set (array of N bit items)

MASK SETS & FLAG SETS

MASK Sets are arrays of bit-fields of some bit-width (5, 3, ... ) they are set/returned as unsigned integer values. They are stored-in/accessed via a uint8_t which gives byte-offset calculations. they return their value as uintmax_t from the offset memory address directly; Some platforms(Arm) may SIGBUS because of wide offset accesses spanning word boundaries. This issue may be fixed by rounding, grabbing the word aligned values and shifting manually Declarataion/Instantiation of a mask set is done with MASKSET macro below