va
This commit is contained in:
parent
f13ad2d2ce
commit
f6f4edd7bd
3 changed files with 28 additions and 23 deletions
2
index.js
2
index.js
|
|
@ -1,6 +1,7 @@
|
||||||
import { dlopen, FFIType } from "bun:ffi";
|
import { dlopen, FFIType } from "bun:ffi";
|
||||||
|
|
||||||
// Funzione JavaScript equivalente
|
// Funzione JavaScript equivalente
|
||||||
|
|
||||||
function jsTest() {
|
function jsTest() {
|
||||||
let c = "qwertyuiopasdfghjkllzxcvbnm123456789mnbvcxzlkjhgfdsapoiuytrewq1234567890";
|
let c = "qwertyuiopasdfghjkllzxcvbnm123456789mnbvcxzlkjhgfdsapoiuytrewq1234567890";
|
||||||
let j = '';
|
let j = '';
|
||||||
|
|
@ -18,6 +19,7 @@ function jsTest() {
|
||||||
console.log(`JavaScript Execution Time: ${end - start}ms`);
|
console.log(`JavaScript Execution Time: ${end - start}ms`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Carica la libreria C
|
// Carica la libreria C
|
||||||
const path = `./libtesticolo.so`;
|
const path = `./libtesticolo.so`;
|
||||||
const { symbols } = dlopen(path, {
|
const { symbols } = dlopen(path, {
|
||||||
|
|
|
||||||
BIN
libtesticolo.so
BIN
libtesticolo.so
Binary file not shown.
17
test.c
17
test.c
|
|
@ -1,18 +1,20 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
void parseH(char *p);
|
int testicolo( void ) {
|
||||||
void parseL(char *p);
|
|
||||||
|
char c[] = "qwertyuiopasdfghjkllzxcvbnm123456789mnbvcxzlkjhgfdsapoiuytrewq1234567890";
|
||||||
|
|
||||||
void testicolo(char *input, char *output) {
|
|
||||||
strcpy(output, input);
|
|
||||||
for(int a=0;a<1000;a++){
|
for(int a=0;a<1000;a++){
|
||||||
parseH(output);
|
parseH(&c);
|
||||||
parseL(output);
|
parseL(&c);
|
||||||
|
// printf("%s",c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void parseH(char *p){
|
void parseH(char *p){
|
||||||
int ln=strlen(p);
|
int ln=strlen(p);
|
||||||
for(int a=0; a<ln; a++){
|
for(int a=0; a<ln; a++){
|
||||||
|
|
@ -20,6 +22,7 @@ void parseH(char *p) {
|
||||||
p[a]=p[a]-32;
|
p[a]=p[a]-32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void parseL(char *p){
|
void parseL(char *p){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue