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.

15 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7
votes
0answers
50 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 ...
4
votes
0answers
88 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: ...
4
votes
0answers
78 views

Bit Vector implementation

Looking for a general review. ...
4
votes
0answers
116 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 ...
3
votes
0answers
87 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 ...
3
votes
0answers
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'...
2
votes
0answers
76 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 ...
2
votes
0answers
207 views

Binary addition in VB.net

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 ...
2
votes
0answers
599 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 ...
2
votes
0answers
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). ...
2
votes
1answer
118 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 ...
2
votes
0answers
872 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 ...
1
vote
0answers
112 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 ...
1
vote
0answers
133 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 ...
1
vote
0answers
83 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 ...