[guru-lang] r527 committed - fixing some 32-bit issues in uwarray.g

0 views
Skip to first unread message

guru...@googlecode.com

unread,
Aug 3, 2011, 12:13:11 PM8/3/11
to guru...@googlegroups.com
Revision: 527
Author: aaron.stump
Date: Wed Aug 3 09:12:32 2011
Log: fixing some 32-bit issues in uwarray.g
http://code.google.com/p/guru-lang/source/detail?r=527

Modified:
/branches/1.0/lib/uwarray.g

=======================================
--- /branches/1.0/lib/uwarray.g Sun Jun 12 09:40:51 2011
+++ /branches/1.0/lib/uwarray.g Wed Aug 3 09:12:32 2011
@@ -16,7 +16,7 @@
: Fun(spec A:type)(n:word)(#untracked a:A).#unique <uwarray A n> :=
fun(spec A:type)(n:word)(a:A). (mkvec A a (word_to_nat n)) <<END
void *guwarray_new(unsigned int n, int a) {
- void **h = (void **)guru_malloc(sizeof(int)*n);
+ int *h = (int *)guru_malloc(sizeof(int)*n);
// fprintf(stdout,"gmk_uwarray(%x).\n", h);
unsigned int c;
for (c = 0; c < n; c++)
@@ -31,7 +31,7 @@
fun(spec A:type)(spec n:word)(l:<uwarray A n>)(i:word)(u:{(ltword i n) =
tt}).
abbrev p = hypjoin (lt (to_nat i) (to_nat n)) tt by u end in
(vec_get A (word_to_nat n) l (word_to_nat i) p) <<END
-inline void* guwarray_get(void **l, unsigned int i) { return l[i]; }
+inline int* guwarray_get(int *l, unsigned int i) { return l[i]; }
END.

Define primitive uwarray_set
@@ -43,8 +43,8 @@
(u:{(ltword i n) = tt}).
abbrev p = hypjoin (lt (to_nat i) (to_nat n)) tt by u end in
(vec_update A (word_to_nat n) l (word_to_nat i) a p) <<END
-void *guwarray_set(void *l, unsigned int c, void *d) {
- ((void **)l)[c] = d;
+int guwarray_set(int *l, unsigned int c, int d) {
+ ((int *)l)[c] = d;
return l;
}
END.

Reply all
Reply to author
Forward
0 new messages