4 ms·
> remove bit twiddling — System programming languages like C, C++, Odin, and Zig need to manipulate bits, but a scientific DSL like Fortran does not need bit tw
by minetest2048 3mo ago
> remove bit twiddling — System programming languages like C, C++, Odin, and Zig need to manipulate bits, but a scientific DSL like Fortran does not need bit twiddling operators like &, |, ~, and so on. Bits are, after all, hardware-level concepts.
Yeah no, your language will be DOA if you don't have bit twiddling, because you can't write arbitrary binary file parser / writer without some sort of bit manipulation.
Even matlab have bit twiddling function
- bombcar 3mo agoThose who don't have bit twiddling instructions are doomed to rebuild them badly via heavier actions and compiler optimizations.
- minetest2048 3mo agoThat brings up some weird memories.. I saw 2 different researchers do bit manipulation in Matlab by printing the binary data as hexadecimal string, doing string manipulation on it and convert it back to binary
- lpribis 3mo agoAlso bit twiddling is very useful in a scientific language when you want to "simulate" a lower level embedded processor, typically fixed or floating DSP or controls code. For example MATLAB/simulink are very commonly used as a high level language before porting the algorithm to a DSP, FPGA, or ASIC, and for this they support bit twiddling and integer/fixed point arithmetic.
- pklausler 3mo agoThis point was weird, since Fortran has never had bitwise operators, as such. (It has had bitwise intrinsic functions since the “mil-spec” extensions in the late 70’s.)