diff --git a/index.js b/index.js index 8f77754..98bab86 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,7 @@ import { dlopen, FFIType } from "bun:ffi"; // Funzione JavaScript equivalente + function jsTest() { let c = "qwertyuiopasdfghjkllzxcvbnm123456789mnbvcxzlkjhgfdsapoiuytrewq1234567890"; let j = ''; @@ -18,6 +19,7 @@ function jsTest() { console.log(`JavaScript Execution Time: ${end - start}ms`); } + // Carica la libreria C const path = `./libtesticolo.so`; const { symbols } = dlopen(path, { diff --git a/libtesticolo.so b/libtesticolo.so index 6fbf6f6..00e1e4f 100755 Binary files a/libtesticolo.so and b/libtesticolo.so differ diff --git a/test.c b/test.c index aae95c5..e243f87 100644 --- a/test.c +++ b/test.c @@ -1,32 +1,35 @@ -#include #include #include -void parseH(char *p); -void parseL(char *p); +int testicolo( void ) { + + char c[] = "qwertyuiopasdfghjkllzxcvbnm123456789mnbvcxzlkjhgfdsapoiuytrewq1234567890"; + + for(int a=0;a<1000;a++){ + parseH(&c); + parseL(&c); +// printf("%s",c); + } -void testicolo(char *input, char *output) { - strcpy(output, input); - for (int a = 0; a < 1000; a++) { - parseH(output); - parseL(output); - } + return 0; } -void parseH(char *p) { - int ln = strlen(p); - for (int a = 0; a < ln; a++) { - if (p[a] < 123 && p[a] > 96) { - p[a] = p[a] - 32; - } - } -} - -void parseL(char *p) { - int ln = strlen(p); - for (int a = 0; a < ln; a++) { - if (p[a] < 91 && p[a] > 64) { - p[a] = p[a] + 32; + +void parseH(char *p){ + int ln=strlen(p); + for(int a=0; a96){ + p[a]=p[a]-32; + } + } + +} + +void parseL(char *p){ + int ln=strlen(p); + for(int a=0; a64){ + p[a]=p[a]+32; } } }