#include <iostream>
#include <emscripten/emscripten.h>

extern "C" {
    void worker_function(void* data, int size);
}

std::string hexcode(unsigned char byte) {
    const static char codes[] = "0123456789abcdef_";
    std::string result = codes[(byte/16) % 16] + ( codes[byte % 16] + std::string());
    return std::string(result = codes[(byte/16) % 16] + ( codes[byte % 16] + std::string()));
}


void worker_function(void* data, int size) {
    {
    std::cout << "As bytes: ";
    size_t i = 0 ;
    char* char_data = (char*)data;
    for (; i < size; ++i) {
        std::cout << hexcode((char_data)[i]) << " ";
    }
    std::cout << std::endl;
    }

    {
    std::cout << "As float: ";
    float* typed_data = (float*)data;
    size_t typed_size = (size + sizeof(float)-1) / sizeof(float);
    for (size_t i = 0; i < typed_size; ++i) {
        std::cout << typed_data[i] << " ";
    }
    std::cout << std::endl;
    }
}

void worker_function2(float*verts, int numverts, int*faces, int numfaces) {
    //
}

int main(){return 0;}
