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
module lt | |
data lt : Nat -> Nat -> Set where | |
succ : lt x (S x) | |
widen : lt x y -> lt x (S y) | |
next : lt x y -> lt (S x) (S y) | |
next succ = succ | |
next (widen p) = widen (next p) |
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
typedef unsigned int sz; | |
typedef unsigned short ix; | |
int compare(const char* a, const char* b, sz n) { | |
while (n) { | |
if (*a != *b) { | |
return (unsigned char)*a - (unsigned char)*b; | |
} | |
if (*a == 0) { | |
return 0; |
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
pure fn to_number(byte: u8) -> int { | |
(byte - '0' as u8) as int | |
} | |
pure fn to_byte(number: int) -> u8 { | |
(number + '0' as int) as u8 | |
} | |
pure fn lt(a: &[u8], b: &[u8]) -> bool { | |
let alen = a.len(), blen = b.len(); |
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
extern mod core; | |
use core::comm; | |
use core::task; | |
fn find_max_and_count(list: ~[int]) -> (int, uint) { | |
let min = list.min(); | |
let max = list.max(); | |
let range = (max - min) as uint; | |
let mut count = vec::from_elem(range + 1, 0); |
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
extern mod std; | |
fn lt<T: Ord>(a: Option<T>, b: Option<T>) -> bool { | |
match (a, b) { | |
(None, None) => false, | |
(None, Some(_)) => true, | |
(Some(_), None) => false, | |
(Some(a), Some(b)) => a < b | |
} | |
} |
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
1MEVAAwyyrBvmBe5PTVGLePWnZN7D5VrGY |
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
ifndef ARM | |
run: libjsval.so js.x64 | |
LD_LIBRARY_PATH=. ./js.x64 | |
else | |
run: libjsval.so js.arm | |
endif | |
clean: | |
rm -f *.ll *.s *.so *.x64 *.arm |
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
extern mod extra; | |
fn test_vector() -> ~[f32] { | |
let mut v = ~[]; | |
for std::uint::range(0, 64) |i| { | |
v.push(i as f32); | |
} | |
v | |
} |
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
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDlMgzbZiFoYZAG12L4yTLyijOgu65mhOGWzTen+PfEDuL17/iYw49YOqd/T80z5dEVG6/E26in/Xkamr9NwYs6exxL3nKmRkDUbud8YJFZNwNQQY1UWUo12oRy0aoioBZAU0FJhWMsUFFyna7bgFO/MKxiHBFGiNERpl7iRR8RQ+oO84jZrlgrNX0klwMUFEskUbWFvjMSxpCePbsr9zu2xOiRyDbP8dF8tWnqU8tSJ7f4YzVXBYcjOUV1tBYZwtb5XSS6Oex4uyFOXyLyan/MkHHiY9lFE/qmO3ZVQibGK+OrKdN7QtHXsuOHaUW9kRLTP5k1BLsPSFSKF4RNTMlP [email protected] |
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
#!/bin/sh | |
gcc -shared -fPIC sub.c -o libhost.so | |
gcc main.c -L. -lhost -o host | |
LD_LIBRARY_PATH=. ./host |