Skip to content

DictumMortuum/clib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clib

Migrating the common libraries that I used during my university years to github, using https://matt.sh/howto-c as a guide.

bitmap

I would love to use uint8_t as a type to represent 'byte', but in this module I can't use the stdint.h types.

src/bitmap.c:60:11: error: conversion to ‘uint64_t {aka long unsigned int}’ from ‘int’ may change the sign of the result [-Werror=sign-conversion]
     *byte |= 1 << bit;
           ^

I could get past the issue with type casting, as described in the following stackoverflow answers:

However, if you have to do bitwise operators, it's probably best to just use the int type, because that way you will get past checks of whether the system uses 32bit or 64bit integers. Additionally, even if you ask for a uint8_t, you will probably get a whole word due to memory alignment.

The purpose of using uint8_t as a type was not to save memory space, but to have more concise and easy-to-read code.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages