strlcpy(3)
-1802633287 & 0xffffff
function HSLAfromTWcode(twCode: number, hasAlpha?: boolean): [number, number, number, number] {
const hsla: [number, number, number, number] = [0, 0, 0, 255];
if (hasAlpha) {
hsla[3] = (twCode >> 24) & 0xff;
twCode = twCode & 0x00ffffff;
}
hsla[0] = ((twCode >> 16) & 0xff) * (360 / 255);
hsla[1] = ((twCode >> 8) & 0xff) * (100 / 255);
hsla[2] = (twCode & 0xff) * (100 / 255);
hsla[3] /= 255;
return hsla;
}
array[0] | (array[1] << 8) | (array[2] << 16) | (array[3] << 24)
array[0] | (array[1] << 8) | (array[2] << 16) | (array[3] << 24)
fn main() {
let num: [u8; 4] = 42u32.to_le_bytes();
//how to convert these bytes into a number string, how to get "42"
}
here's what i have, and what i need to get xdu8
* 2
and + 1
on thatfn main() {
let num: [u8; 4] = 42u32.to_le_bytes();
//how to convert these bytes into a number string, how to get "42"
}
here's what i have, and what i need to get xd char s[] = "01001011";
int value = 0;
for (int i=0; i< strlen(s); i++) // for every character in the string strlen(s) returns the length of a char array
{
value *= 2; // double the result so far
if (s[i] == '1') value++; //add 1 if needed
}
Serial.println(value);
I yonked this code from some forum but i can this mafs on string and get what i need.strlen
which gives you a nice nasty O(n^2)
algorithm)fn mul2(s: &str) -> String {
todo!();
}
fn inc1(s: &str) -> String {
todo!();
}
fn the_function(bytes: &[u8]) -> String {
let mut res = String::new();
for byte in bytes {
for i in 0..8 {
let bit = (byte >> i) & 1;
res = mul2(&res);
if bit == 1 {
res = inc1(&res);
}
}
}
res
}
fn main() {
let num: [u8; 4] = 0x45u32.to_be_bytes();
let num_str = the_function(&num);
}
i plan to do smth like thismul2
a string?mul2("1") == "10"
mul2
is wrong, what does 2 have to do with 10?mul10
and add
not inc
Vec<u8>
base 10 reprmul2
and add1
like long addition/long multiplication on paper$ objdump -p DDNet | grep NEEDED
NEEDED libfreetype.so.6
NEEDED libSDL2-2.0.so.0
NEEDED libdl.so.2
NEEDED libvulkan.so.1
NEEDED libGL.so.1
NEEDED libnotify.so.4
NEEDED libgdk_pixbuf-2.0.so.0
NEEDED libgio-2.0.so.0
NEEDED libgobject-2.0.so.0
NEEDED libglib-2.0.so.0
NEEDED libcurl.so.4
NEEDED librt.so.1
NEEDED libm.so.6
NEEDED libpthread.so.0
NEEDED libc.so.6
NEEDED ld-linux-x86-64.so.2
SDL_ANDROID_TRAP_BACK_BUTTON
hint, so it can be handled in our code reliably instead of letting the system handle it.
Interpret fast repeated presses of the back-button (5 times within 1 second) as a quit-event, so the app can be quit cleanly and quickly without using the UI. The client settings ...