Skip to content

Commit

Permalink
Fix memcpy and type comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
ParfenovIgor committed Jan 4, 2025
1 parent ce59b84 commit fe6abdb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions arch/x86/memory.asm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
global _memcpy
_memcpy:
call _cpy_dir
ret

global _memmove
_memmove:
Expand Down
12 changes: 8 additions & 4 deletions compiler/src/type.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ bool type_equal(struct TypeNode *n1, struct TypeNode *n2, struct CPContext *cont
if (n1->node_type == TypeNodeStruct) {
struct TypeStruct *_n1 = n1->node_ptr;
struct TypeStruct *_n2 = n2->node_ptr;
int sz = vsize(&_n1->names);
for (int i = 0; i < sz; i++) {
int sz1 = vsize(&_n1->names);
int sz2 = vsize(&_n2->names);
if (sz1 != sz2) return false;
for (int i = 0; i < sz1; i++) {
if (_strcmp(_n1->names.ptr[i], _n2->names.ptr[i]) ||
!type_equal(_n1->types.ptr[i], _n2->types.ptr[i], context)) {
return false;
Expand All @@ -75,8 +77,10 @@ bool type_equal(struct TypeNode *n1, struct TypeNode *n2, struct CPContext *cont
if (n1->node_type == TypeNodeFunction) {
struct TypeFunction *_n1 = n1->node_ptr;
struct TypeFunction *_n2 = n2->node_ptr;
int sz = vsize(&_n1->types);
for (int i = 0; i < sz; i++) {
int sz1 = vsize(&_n1->types);
int sz2 = vsize(&_n2->types);
if (sz1 != sz2) return false;
for (int i = 0; i < sz1; i++) {
if (!type_equal(_n1->types.ptr[i], _n2->types.ptr[i], context)) {
return false;
}
Expand Down

0 comments on commit fe6abdb

Please sign in to comment.