mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-06 20:56:36 +02:00
Issue #155 - Check bytevectors for deep equality
This commit is contained in:
parent
0e5a8685bd
commit
2ce541ed4b
2 changed files with 14 additions and 0 deletions
|
@ -7,6 +7,7 @@ Features
|
|||
|
||||
Bug Fixes
|
||||
|
||||
- Thanks to Koz Ross, `equal?` has been updated to check bytevectors for deep equality.
|
||||
- Display characters such as `#\space` correctly when output via `write`.
|
||||
- Thanks for Seth Alves, removed unnecessary include of `ck_string.h` which is not provided in older versions of `libck`.
|
||||
|
||||
|
|
13
runtime.c
13
runtime.c
|
@ -588,6 +588,19 @@ int equal(object x, object y)
|
|||
return 1;
|
||||
}
|
||||
return 0;
|
||||
case bytevector_tag:
|
||||
if (is_object_type(y) &&
|
||||
type_of(y) == bytevector_tag &&
|
||||
((bytevector) x)->len == ((bytevector) y)->len) {
|
||||
int i;
|
||||
for (i = 0; i < ((bytevector) x)->len; i++) {
|
||||
if (((bytevector)x)->data[i] != ((bytevector)y)->data[i]) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
default:
|
||||
return x == y;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue