initial commit - hbb - hyperbitblock
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit b29f0389d6907c6c4599bad9b0fef1317b14a092
DIR parent febf06961c27bbacbb5616490a31c323c9da75d4
HTML Author: kroovy <me@kroovy.de>
Date: Wed, 16 Apr 2025 15:04:33 +0200
initial commit
Diffstat:
A .gitignore | 4 ++++
A Makefile | 22 ++++++++++++++++++++++
A hyperbitblock.c | 50 +++++++++++++++++++++++++++++++
3 files changed, 76 insertions(+), 0 deletions(-)
---
DIR diff --git a/.gitignore b/.gitignore
@@ -0,0 +1,4 @@
+hyperbitblock.o
+hyperbitblock
+*.swp
+*.swo
DIR diff --git a/Makefile b/Makefile
@@ -0,0 +1,22 @@
+.POSIX:
+
+BIN = hyperbitblock
+OBJ = $(BIN:=.o)
+
+LDFLAGS += -v -static -Wall -Wextra -pedantic
+
+all: $(BIN)
+
+$(BIN): $(OBJ)
+ $(CC) $(OBJ) $(LDFLAGS) -o $@
+
+$(OBJ): Makefile
+
+clean:
+ rm -f $(BIN) $(OBJ)
+
+install:
+ cp hyperbitblock /usr/local/bin/hyperbitblock
+
+uninstall:
+ rm -f /usr/local/bin/hyperbitblock
DIR diff --git a/hyperbitblock.c b/hyperbitblock.c
@@ -0,0 +1,50 @@
+#define _POSIX_SOURCE
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+#include <unistd.h>
+
+int
+is_bit_set(unsigned value, unsigned bitindex) {
+ return (value & (1 << bitindex)) != 0;
+}
+
+int
+main
+(void)
+{
+
+ uint8_t v4[] =
+ {
+ 0b00000000 /* 18 */
+ , 0b00010000 /* 119 */
+ , 0b01001000 /* 9 */
+ , 0b10101011 /* 193 */
+ };
+
+ //uint8_t v4[] =
+ //{
+ // 0b00001010 /* 10 */
+ // , 0b00000000 /* 0 */
+ // , 0b00000000 /* 0 */
+ // , 0b00010110 /* 22 */
+ //};
+
+ uint32_t i32 = (v4[0] << 24) | (v4[1] << 16) | (v4[2] << 8) | v4[3];
+
+
+ //uint8_t v = 0b0000011;
+ //uint8_t i = 0;
+
+ printf("My IP is: %u.%u.%u.%u\n",v4[0],v4[1],v4[2],v4[3]);
+ printf("That calculates to: %u\n",i32);
+
+ //if (is_bit_set(v, i)) {
+ // printf("bit is set at index: %d\n", i);
+ //} else {
+ // printf("bit is not set at index: %d\n", i);
+ //}
+
+ return 0;
+}