Skip to content

Instantly share code, notes, and snippets.

View ms0g's full-sized avatar
👾

M. Sami GÜRPINAR ms0g

👾
View GitHub Profile
@ms0g
ms0g / ipv4_checksum.cpp
Created July 30, 2020 11:33
Ipv4 header checksum calculation
/**
* Compute Internet Checksum for "count" bytes
* beginning at location "addr".
* @param addr start of the ip header
* @param count ip header size
* @return Taking the ones' complement (flipping every bit) yields 0000,
* which indicates that no error is detected.
*/
uint16_t checksum(void *addr, int count) {
uint32_t sum = 0;
/**
* @file concurrent_map.hpp
* @author M. Sami GÜRPINAR <sami.gurpinar@gmail.com>
*
* @brief
* Implementation of concurrent_map.
*/
#pragma once
@ms0g
ms0g / concurrent_queue.hpp
Last active October 9, 2020 08:58
Simple Concurrent Queue
/**
* @file concurrent_queue.hpp
* @author M. Sami GÜRPINAR <sami.gurpinar@gmail.com>
*
* @brief
* Implementation of concurrent_queue.
*
*/
#pragma once