Created
August 9, 2016 05:54
-
-
Save xspager/65e04abc3751f4c58cd84782fcf31936 to your computer and use it in GitHub Desktop.
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
local C = terralib.includec("stdio.h") | |
local intel_x86_target = terralib.newtarget { | |
Triple = "x86_64-apple-darwin"; | |
-- CPU = ; | |
Features = "+sse,+mmx"; | |
} | |
struct Person { | |
age: int | |
} | |
terra main() | |
C.printf("Hello :)\n") | |
var people: Person[10000] | |
var buff: (&Person)[10000] | |
var i = 10 / 1000 | |
for x = 0, 10000 do | |
people[x].age = i + 2*x | |
C.printf("%d\n", i) | |
end | |
for x = 0, 10000 do | |
buff[x] = &people[x] | |
end | |
for x = 0, 10000 do | |
buff[x].age = buff[x].age / 4 | |
end | |
for x = 0, 10000 do | |
C.printf("%d\n", buff[x].age) | |
end | |
end | |
terralib.saveobj("target.o", {main=main}, {}, intel_x86_target) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment