]> git.lizzy.rs Git - uwu-lang.git/blobdiff - api/int.c
uwuint: use long instead of int to prevent YEAR2038 problem in nolambda time library
[uwu-lang.git] / api / int.c
index b1e0c69a98305294661e756b43a7a6cf8be1527f..dc7d8ceb937ce0cdf54d5c0a371e7fa67676d5b4 100644 (file)
--- a/api/int.c
+++ b/api/int.c
@@ -2,32 +2,32 @@
 #include "common/str.h"
 #include "int.h"
 
-UwUVMValue uwuint_create(int value)
+UwUVMValue uwuint_create(long value)
 {
        UwUVMValue vm_value = {
                .type = &uwuint_type,
-               .data = malloc(sizeof(int))
+               .data = malloc(sizeof(long))
        };
-       *(int *) vm_value.data = value;
+       *(long *) vm_value.data = value;
 
        return vm_value;
 }
 
 int uwuint_get(UwUVMValue vm_value)
 {
-       return *(int *) vm_value.data;
+       return *(long *) vm_value.data;
 }
 
 void *uwuint_clone(void *data)
 {
-       int *copy = malloc(sizeof(*copy));
-       *copy = *(int *) data;
+       long *copy = malloc(sizeof(*copy));
+       *copy = *(long *) data;
        return copy;
 }
 
 char *uwuint_print(void *data)
 {
-       return asprintf_wrapper("%d", *(int *) data);
+       return asprintf_wrapper("%l", *(long *) data);
 }
 
 UwUVMType uwuint_type = {