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
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 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 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 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 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 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 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 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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
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
Red/System [] | |
int64!: alias struct! [high [integer!] low [integer!]] | |
sub64: func [ | |
a [int64!] | |
b [int64!] | |
return: [int64!] | |
/local | |
diff [int64!] offset [integer!] |
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
Red/System [] | |
#import [ | |
LIBC-file cdecl [ | |
sin: "sin" [ | |
x [float!] | |
return: [float!] | |
] | |
] | |
] |