Results for “Containers & compound values”
Small, practical examples. Search by task or narrow things down below.
Assign a bit from a Boolean state
Arduino / C: bitWrite accepts a bit position and a zero or nonzero value.
Arduino / C✓ Tested
Calculate a CRC-8 over a byte sequence
Arduino / C: This implementation uses polynomial 0x07, initial zero, and no reflection.
Arduino / C✓ Tested
Calculate a SHA-256 content digest
Java: Hash UTF-8 bytes and format the result as lowercase hexadecimal.
Java✓ Tested
Calculate a simple packet XOR checksum
Arduino / C: XOR all payload bytes to produce a basic error-detection byte.
Arduino / C✓ Tested
Capture configuration by value in a callable
C++: A value capture retains the value from lambda creation even if the original variable changes later.
C++✓ Tested
Chain operations that may return None
Chain operations that may return None in a complete Rust program using the standard library.
Rust✓ Tested
Clear a flag without affecting neighboring bits
Arduino / C: bitClear resets only the selected bit.
Arduino / C✓ Tested
Convert bytes to hexadecimal and back
Java: Use HexFormat for a standard-library representation of raw bytes.
Java✓ Tested
Decode a form query parameter
Java: URLDecoder reverses form encoding and treats plus as a space.
Java✓ Tested
Encode a form query parameter
Java: URLEncoder uses application/x-www-form-urlencoded rules, including plus signs for spaces.
Java✓ Tested
Encode a value as little-endian bytes
Arduino / C: Store the least significant byte first when the protocol requires it.
Arduino / C✓ Tested
Encode and decode Base64 bytes
Java: Convert through UTF-8 explicitly before and after Base64 encoding.
Java✓ Tested