consoleHex
outputs a label and a hexadecimal custom value.
Requires
#include "tiktag.h"
Definition
void consoleHex(const char* label, unsigned int value);
Description
The consoleHex()
function outputs a label and a custom hexadecimal value to the console-output of your browser. This function typically is used to debug C++ code, especially when programming bit-operation code.
Parameters
label
: A zero-terminated ASCII String (Label)
value
: custom unsigned integer value
Return Value
void
Remarks
-
Example: debug C++ bit-operations and display console-output of hex-values
main.js:
import {_wasmInitA} from "./tt/ttWASM.js";
import wasm from "./web.wasm";
async function main()
{
const wasmInstance = await _wasmInitA(wasm, {}, null);
wasmInstance.exports.doProcessing();
}
main();
myCppExample.cpp:
#include "tiktag.h"
_export void doProcessing()
{
unsigned int val1 = 0x5555aaaa;
consoleHex ("Original Value: ", val1);
val1 ^=0xffffffff;
consoleHex ("XOR'ed Value: ", val1);
val1 = (val1<<16)|0xaaaa;
consoleHex ("shifted and OR'ed value: ", val1);
}
Output:
