This file contains hidden or 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
Red/System [ | |
Title: "Float32! to integer! conversion routine" | |
Author: "Nenad Rakocevic" | |
Rights: "Copyright (C) 2011 Nenad Rakocevic. All rights reserved." | |
License: "BSD-3 - https://github.com/dockimbel/Red/blob/origin/BSD-3-License.txt" | |
Note: "Thanks to François Jouen for providing me the C code for ftoi()" | |
] | |
float-to-integer: func [ | |
f [float32!] ;-- float 32-bit value to convert |
This file contains hidden or 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
int64_t ipow(int64_t base, uint8_t exp) { | |
static const uint8_t highest_bit_set[] = { | |
0, 1, 2, 2, 3, 3, 3, 3, | |
4, 4, 4, 4, 4, 4, 4, 4, | |
5, 5, 5, 5, 5, 5, 5, 5, | |
5, 5, 5, 5, 5, 5, 5, 5, | |
6, 6, 6, 6, 6, 6, 6, 6, | |
6, 6, 6, 6, 6, 6, 6, 6, | |
6, 6, 6, 6, 6, 6, 6, 6, | |
6, 6, 6, 6, 6, 6, 6, 255, // anything past 63 is a guaranteed overflow with base > 1 |
This file contains hidden or 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
/* | |
REBOL Syntax | |
2012 by Christopher Ross-Gill | |
Based in Part on REBOLSource / REBOL Syntax by Earl, Ladislav and Steeve | |
https://github.com/rebolsource/rebol-syntax/ | |
Designed for use with: | |
http://railroad.my28msec.com/rr/ui | |
For Future Ref: |
This file contains hidden or 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
make object! [ | |
; Private Unicode Area for encoded delimiters and octets | |
url-pua-start: #"^(e000)" | |
url-pua-end: #"^(e0ff)" | |
delimiter: charset ":/?#[]@!$&'()*+,;=" | |
hex-digit: charset [#"0" - #"9" #"a" - #"f" #"A" - #"F"] | |
ascii: charset [#"^(00)" - #"^(7f)"] |
This file contains hidden or 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
Red/System [ | |
Title: "Mersenne Twister Random Function" | |
Author: "XieQ" | |
Tabs: 4 | |
Purpose: { | |
Generates a random number using the Mersenne Twister algorithm. | |
Reference http://code.google.com/p/c-standard-library/source/browse/src/internal/_rand.c | |
} | |
] |
This file contains hidden or 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
Red [ | |
Title: "Split mezzanine" | |
Purpose: {split a string} | |
Author: "Rudolf W. MEIJER" | |
File: %split.red | |
Version: "0.0.0" | |
Date: "10-May-2015" | |
Rights: "(c) Copyright 2015 Rudolf W. MEIJER" | |
License: "TBD" ; source license (URL or full text) | |
] |
This file contains hidden or 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
Red/System [ | |
Title: "Red/System stream-io test - WAV reader" | |
Author: "Oldes" | |
] | |
#define handle! [pointer! [integer!]] | |
#define GENERIC_WRITE 40000000h | |
#define GENERIC_READ 80000000h | |
#define FILE_SHARE_READ 00000001h |
This file contains hidden or 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
Red [] | |
forth: context [ | |
prog: [1 2 3 4 5 6 7 8 '+ '+ '* 150 '+ '* '+ '* '*] | |
registers: ['eax 'ebx 'ecx 'edx] | |
register-taint: [] ; registers we've touched in this set | |
register-goop: [] ; registers we need to pop to use | |
register-sets: 0 | |
next-register: head registers |
This file contains hidden or 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
Red [ | |
Title: "Tile game" | |
Purpose: {An implementation in Red of the 4x4 sliding tile puzzle} | |
Author: "Rudolf W. MEIJER (meijeru)" | |
File: %tile-game.red | |
Needs: 'View | |
Usage: { | |
Click on any tile that is adjacent to the empty space | |
and it will shift to that space. | |
Try to obtain a given configuration, e.g. 1 to 15 in order. |
This file contains hidden or 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
Red [] | |
random/seed 1337 | |
; produces a series of chromosomes within [0, dna] of each supplied maximum | |
make-dna-strand: func[dna | |
/local dna-length result][ | |
dna-length: length? dna | |
result: make block! dna-length | |
foreach chromosome dna [ |