-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|66|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-




Pakz

Lerp function (Linear Interpolation)

12th November 2017 Monkey-X
Return number between low and high


Pakz

Binary addition

30th August 2017 Monkey-X
Function+example that adds binary up by 1


Cower

3D Maths Classes

2nd March 2013 Monkey
A large-ish combined header of the libsnow-common maths classes.


HoboBen

Circular Buffer (C)

22nd April 2011 Monkey
A fast fixed-size buffer. which you can pretend is ''infinite memory'' for data that you don't care too much about.
When you write to it, it fills up until you start overwriting the oldest data. When reading, it returns the oldest data it has.
Id*snip*


HoboBen

Bi-directional C and Lua

12th January 2011 Monkey, Cross Platform
Just the simplest of examples. A C host program runs a Lua script, gets and sets the script's variables, runs the script's functions, and provides a C function for the script to call.
(Lua 5.1)
bidirectional.lua
[code]
FirstName = ''Unset'';
S*snip*


HoboBen

Convert a double to bytes and back in C

6th December 2010 Monkey, Server Based
By using a C union data structure, it's simple to convert a double to its raw bytes and back.
Note that the actual order of bytes varies depending on machine endianness.
[code]
#include <stdlib.h>
#include <stdio.h>
union {
double d; *snip*


Phoenix

Fast inverse square root

29th June 2009 Monkey
Found this while browsing about the net, and I thought it could be useful (or at least an interesting read). Lengthy explanation, for the mathematically inclined.
[code]
float InvSqrt(float x){
float xhalf = 0.5f * x;
int i = *(int*)&x; // st*snip*

More - Older Posts