Questions tagged [bitwise]

Bitwise refers to a bitwise operation which operates on one or more bit patterns or binary numerals at the level of their individual bits.

16 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
39 views

Fun crypto problem: Exploiting a vulnerable encryption scheme with Python

I came across a question asked here and here on the Crypto Stack Exchange site, and decided to analyze it as a kind of case study. To demonstrate the concept, I wrote a short python script depicting ...
40 views

Binary Trie in F#

I have this little exercise writing a binary trie in F#. In C# it can be done in few lines, but here it became more complicated than I had expected (especially the ...
70 views

RGB to YCbCr conversion in Java

I found a Go language code to do RGB to YCbCr conversion from here! I ported it to Java: ...
74 views

Bit Vector implementation

Looking for a general review. ...
111 views

Parallel popcount of packed bytes

I want to do a popcount of bytes in an array. Not a total popcount of everything, but lots of little popcounts for every individual byte to determine the neighborhood count in GoL. The following ...
55 views

Java code to convert BigDecimal to/from .NET decimal

Background In many languages we have built-in data types for representing decimal floating point numbers. In .NET that's decimal, and in Java we have ...
2k views

Calculating CRC using arbitrary polynomials

This is my implementation of calculating CRCs which supports arbitrary polynomials specified in different representations (according to the explanations given here and here). My concerns are: I don'...
73 views

Kaitai Struct: shift rotate >1 byte groups

This is an implementation of rotation (cyclic shift) of many-byte groups to the left. Rotate right is supported as negative amount. I would like to request, if someone would be willing, to review this ...
183 views

It starts by taking two user input from the console and putting them into strings. I then pad them to get them to the same length. I get the length of the num1 and assign it to the integer len. I then ...
531 views

Hackerrank: Max Score

Problem statement Consider an n-element sequence of integers, A = {a0, a0, ..., an-1}. We want to perform $n$ operations on $A$, where each operation is defined by the following sequence of ...
74 views

Convert tri-gram of type wchar_t to an integer type

I am trying to convert a tri-gram containing 3 characters of type wchar_t to an integer type (an uint64_t at the present time). ...
856 views

Read bits, write bits data to arbitrary position in char array

I created functions to read bit data from arbitrary bit position of a char array to long long int, and I also created a function ...
97 views

Sending data from UART to microcontroller via AT89C2051 functioning as a UART/SPI bridge

I have an unusual setup. I have an AT89S52 microcontroller in which its UART is used by the PC. I needed a way to make a second UART based device work with it, so what I decided to do was make a UART ...
127 views

Getting TLE for SPOJ Bitplay challenge program

I have tried a naive way to solve this problem: Given a even number N (N ≤ 109) and an integer K, you have to find the greatest odd number M less than N such that the sum of digits in binary ...
81 views

Implement “at” lens for Data.Map

I've been working on adding an operation like Data.Lens.At.at to Data.Map. This uses an extremely fast, extremely small, and ...
100 views

A bitwise common prefix algorithm in Python

Is my algorithm slow because it has problems? Or, is any bitwise common prefix solution not going to give me the performance I'm looking for? After profiling my algorithm, I found that over 60% of ...