GeorgeMLP / datalab

It's all just bits!

Repository from Github https://github.comGeorgeMLP/datalabRepository from Github https://github.comGeorgeMLP/datalab

Data Lab

Introduction

ICS Data Lab, Peking University.

The purpose of this assignment is to become more familiar with bit-level representations of common patterns, integers, and floating-point numbers. You’ll do this by solving a series of programming “puzzles,” using only bit-wise operations. For more information about this lab, please refer to datalab.pdf.

Installation

It is recommended to do this lab on Ubuntu 22.04. Make sure you have the following package installed:

sudo apt-get install gcc-multilib

Score

Your score will be computed out of a maximum of 80 points based on the following distribution:

  • 48: Correctness of code.
  • 32: Performance of code, based on number of operators used in each function.

The following table shows my score and the best score in my class. Some of my implementations are not optimal, and it is possible to finish them with fewer number of operations.

Puzzle My score My total ops Least total ops in class
bitAnd 1 4 4
bitConditional 1 3 3
byteSwap 2 10 10
logicalShift 3 5 5
cleanConsecutive1 4 5 5
countTrailingZero 4 21 20
divpwr2 2 5 5
oneMoreThan 2 7 7
satMul3 3 12 12
subOK 3 8 8
isLessOrEqual 3 7 7
trueThreeFourths 4 9 7
float_twice 4 4 3
float_i2f 4 8 8
float_f2i 4 4 4
float_pwr2 4 1 1
total 80 113 109

About

It's all just bits!

License:MIT License


Languages

Language:C 68.4%Language:Perl 30.7%Language:Makefile 0.6%Language:Raku 0.3%