forked from lcompilers/lpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Allow IntegerBinOp in dimension specification i.e., i16[n*k] 2. Check for type mismatches in c_p_pointer and its target
- Loading branch information
Showing
3 changed files
with
186 additions
and
10 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
from ltypes import c_p_pointer, CPtr, i32, Pointer, i16 | ||
|
||
def fill_A(k: i32, n: i32, b: CPtr) -> None: | ||
nk: i32 = n * k | ||
A: Pointer[i16[nk]] = c_p_pointer(b, i16[k * n]) | ||
i: i32; j: i32 | ||
for j in range(k): | ||
for i in range(n): | ||
A[j*n+i] = i16((i+j)) | ||
|
||
def fill_B(k: i32, n: i32, b: CPtr) -> None: | ||
B: Pointer[i16[n * k]] = c_p_pointer(b, i16[k * n]) | ||
i: i32; j: i32 | ||
for j in range(k): | ||
for i in range(n): | ||
B[j*n+i] = i16((i+j)) | ||
|
||
def fill_C(k: i32, n: i32, b: CPtr) -> None: | ||
C: Pointer[i16[n]] = c_p_pointer(b, i16[n * k]) | ||
i: i32; j: i32 | ||
for j in range(k): | ||
for i in range(n): | ||
C[j*n+i] = i16((i+j)) |