fixed some theoretical bugs

This commit is contained in:
IonutParau 2025-06-29 11:24:49 +02:00
parent 8f5cfb6be1
commit 230de47515
4 changed files with 14 additions and 5 deletions

View File

@ -140,12 +140,9 @@ void nni_gpu_set(nni_gpu *gpu, void *_, nn_component *component, nn_computer *co
return;
}
printf("It is to print: %s\n", s);
int current = 0;
while(s[current] != 0) {
int codepoint = nn_unicode_codepointAt(s, current);
printf("char rendered: %i\n", codepoint);
nn_setPixel(gpu->currentScreen, x, y, nni_gpu_makePixel(gpu, s + current));
if(isVertical) {
y++;

View File

@ -502,7 +502,7 @@ int main() {
.read = (void *)ne_fs_read,
.seek = NULL,
};
nn_addFileSystem(computer, "OpenOS", 1, &genericFS);
nn_addFileSystem(computer, "frostos", 1, &genericFS);
nn_screen *s = nn_newScreen(80, 32, 16, 16, 256);
nn_addKeyboard(s, "shitty keyboard");

View File

@ -65,7 +65,7 @@
#define NN_CALL_HEAT 0.05
#define NN_CALL_COST 1
#define NN_LABEL_SIZE 128
#define NN_INDIRECT_CALL_LATENCY 0.005
#define NN_INDIRECT_CALL_LATENCY 0.0005
typedef struct nn_guard nn_guard;
typedef atomic_size_t nn_refc;

View File

@ -458,6 +458,18 @@ int testLuaArch_unicode_sub(lua_State *L) {
if(stop < 0) stop = 0;
if(start >= len) start = len - 1;
if(stop >= len) stop = len - 1;
if(stop < start) {
lua_pushstring(L, "");
return 1;
}
if(start < 0) {
lua_pushstring(L, "");
return 1;
}
if((stop - start) >= len) {
lua_pushstring(L, "");
return 1;
}
// there is a way to do it without an allocation
// however, I'm lazy
unsigned int *points = nn_unicode_codepoints(s);