Skip to content

A small piece of code which can be reuse anywhere, I call it a unit. This is a collection of unit in C language! Ok, yes, it would be my toolbox.

License

Notifications You must be signed in to change notification settings

GreyZhang/c_units

Repository files navigation

Summary

  • Collect these just for hobby. I’m not sure if all the units can work fine on any platform. Waiting for your advice!

Unit list

covert hex char(s) into a number.

  • code: 01_hexchars2num

swap byte(s) which can be used to swap values and convert endians.

  • code: 02_bytes_swap

CRC calculation

  • code: 03_crc

print ascii table use C.

  • code: 04_ascii

queue using array

  • code: 05_array_queue

Test if an ASCII char is a number.

  • code: 06_is_digit

Find a number in a string.

  • code: 07_skip_atoi

Calculate a variable size and round it to int units.

  • code: 08___va_rounded_szie

Map a number in a range to a new number in another range.

  • code: 09_map

hamming weight calculation

  • code: 10_hamming_weight

hysteresis control, also called bang-bang control

printf

average calculation

set bits

  • a fuction which can support a u32 variable bits set and clear. It can be very easily modified for other data types.
  • code: 13_set_bits

MD5 calculation

  • MD5 Message-Digest Algorithm (RFC 1321)
  • code: 14_md5

couting bits

  • hacker_popcnt
  • code: 15_hacker_popcnt

free and malloc for embedded system.

About

A small piece of code which can be reuse anywhere, I call it a unit. This is a collection of unit in C language! Ok, yes, it would be my toolbox.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages