utils.h

Include dependency graph for utils.h:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "1" [label="/__w/AtomVM/AtomVM/src/libAtomVM/utils.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/utils.h" fillcolor="#BFBFBF"] "2" [label="inttypes.h" tooltip="inttypes.h"] "3" [label="stdbool.h" tooltip="stdbool.h"] "4" [label="stddef.h" tooltip="stddef.h"] "5" [label="stdio.h" tooltip="stdio.h"] "6" [label="stdlib.h" tooltip="stdlib.h"] "1" -> "2" [dir=forward tooltip="include"] "1" -> "3" [dir=forward tooltip="include"] "1" -> "4" [dir=forward tooltip="include"] "1" -> "5" [dir=forward tooltip="include"] "1" -> "6" [dir=forward tooltip="include"] }

This graph shows which files directly or indirectly include utils.h:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "2" [label="/__w/AtomVM/AtomVM/src/libAtomVM/atom.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/atom.c"] "3" [label="/__w/AtomVM/AtomVM/src/libAtomVM/atom_table.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/atom_table.c"] "4" [label="/__w/AtomVM/AtomVM/src/libAtomVM/atom_table.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/atom_table.h"] "8" [label="/__w/AtomVM/AtomVM/src/libAtomVM/avmpack.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/avmpack.c"] "7" [label="/__w/AtomVM/AtomVM/src/libAtomVM/avmpack.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/avmpack.h"] "14" [label="/__w/AtomVM/AtomVM/src/libAtomVM/bif.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/bif.c"] "13" [label="/__w/AtomVM/AtomVM/src/libAtomVM/bif.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/bif.h"] "63" [label="/__w/AtomVM/AtomVM/src/libAtomVM/bitstring.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/bitstring.c"] "62" [label="/__w/AtomVM/AtomVM/src/libAtomVM/bitstring.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/bitstring.h"] "11" [label="/__w/AtomVM/AtomVM/src/libAtomVM/context.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/context.c"] "12" [label="/__w/AtomVM/AtomVM/src/libAtomVM/context.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/context.h"] "18" [label="/__w/AtomVM/AtomVM/src/libAtomVM/debug.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/debug.c"] "17" [label="/__w/AtomVM/AtomVM/src/libAtomVM/debug.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/debug.h"] "53" [label="/__w/AtomVM/AtomVM/src/libAtomVM/defaultatoms.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/defaultatoms.h"] "54" [label="/__w/AtomVM/AtomVM/src/libAtomVM/dictionary.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/dictionary.c"] "66" [label="/__w/AtomVM/AtomVM/src/libAtomVM/dictionary.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/dictionary.h"] "20" [label="/__w/AtomVM/AtomVM/src/libAtomVM/dist_nifs.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/dist_nifs.c"] "55" [label="/__w/AtomVM/AtomVM/src/libAtomVM/dist_nifs.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/dist_nifs.h"] "21" [label="/__w/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h"] "27" [label="/__w/AtomVM/AtomVM/src/libAtomVM/ets.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/ets.c"] "67" [label="/__w/AtomVM/AtomVM/src/libAtomVM/ets.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/ets.h"] "57" [label="/__w/AtomVM/AtomVM/src/libAtomVM/ets_hashtable.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/ets_hashtable.c"] "56" [label="/__w/AtomVM/AtomVM/src/libAtomVM/ets_hashtable.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/ets_hashtable.h"] "68" [label="/__w/AtomVM/AtomVM/src/libAtomVM/exportedfunction.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/exportedfunction.h"] "28" [label="/__w/AtomVM/AtomVM/src/libAtomVM/externalterm.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/externalterm.c"] "69" [label="/__w/AtomVM/AtomVM/src/libAtomVM/externalterm.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/externalterm.h"] "5" [label="/__w/AtomVM/AtomVM/src/libAtomVM/globalcontext.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/globalcontext.c"] "6" [label="/__w/AtomVM/AtomVM/src/libAtomVM/globalcontext.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/globalcontext.h"] "59" [label="/__w/AtomVM/AtomVM/src/libAtomVM/iff.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/iff.c"] "31" [label="/__w/AtomVM/AtomVM/src/libAtomVM/inet.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/inet.c"] "30" [label="/__w/AtomVM/AtomVM/src/libAtomVM/inet.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/inet.h"] "33" [label="/__w/AtomVM/AtomVM/src/libAtomVM/interop.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/interop.c"] "29" [label="/__w/AtomVM/AtomVM/src/libAtomVM/interop.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/interop.h"] "60" [label="/__w/AtomVM/AtomVM/src/libAtomVM/intn.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/intn.c"] "61" [label="/__w/AtomVM/AtomVM/src/libAtomVM/intn.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/intn.h"] "15" [label="/__w/AtomVM/AtomVM/src/libAtomVM/jit.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/jit.c"] "64" [label="/__w/AtomVM/AtomVM/src/libAtomVM/jit.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/jit.h"] "9" [label="/__w/AtomVM/AtomVM/src/libAtomVM/jit_stream_flash.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/jit_stream_flash.c"] "37" [label="/__w/AtomVM/AtomVM/src/libAtomVM/jit_stream_flash.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/jit_stream_flash.h"] "52" [label="/__w/AtomVM/AtomVM/src/libAtomVM/mailbox.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/mailbox.c"] "71" [label="/__w/AtomVM/AtomVM/src/libAtomVM/mailbox.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/mailbox.h"] "19" [label="/__w/AtomVM/AtomVM/src/libAtomVM/memory.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/memory.c"] "74" [label="/__w/AtomVM/AtomVM/src/libAtomVM/memory.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/memory.h"] "16" [label="/__w/AtomVM/AtomVM/src/libAtomVM/module.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/module.c"] "36" [label="/__w/AtomVM/AtomVM/src/libAtomVM/module.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/module.h"] "10" [label="/__w/AtomVM/AtomVM/src/libAtomVM/nifs.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/nifs.c"] "42" [label="/__w/AtomVM/AtomVM/src/libAtomVM/nifs.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/nifs.h"] "34" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c"] "43" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_crypto.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_crypto.h"] "32" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_net.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_net.c"] "44" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_net.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_net.h"] "22" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_socket.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_socket.c"] "45" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_socket.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_socket.h"] "23" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c"] "46" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_ssl.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_ssl.h"] "70" [label="/__w/AtomVM/AtomVM/src/libAtomVM/overflow_helpers.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/overflow_helpers.h"] "38" [label="/__w/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h"] "49" [label="/__w/AtomVM/AtomVM/src/libAtomVM/port.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/port.c"] "50" [label="/__w/AtomVM/AtomVM/src/libAtomVM/port.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/port.h"] "48" [label="/__w/AtomVM/AtomVM/src/libAtomVM/portnifloader.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/portnifloader.c"] "47" [label="/__w/AtomVM/AtomVM/src/libAtomVM/portnifloader.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/portnifloader.h"] "24" [label="/__w/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c"] "58" [label="/__w/AtomVM/AtomVM/src/libAtomVM/posix_nifs.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/posix_nifs.h"] "25" [label="/__w/AtomVM/AtomVM/src/libAtomVM/refc_binary.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/refc_binary.c"] "73" [label="/__w/AtomVM/AtomVM/src/libAtomVM/refc_binary.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/refc_binary.h"] "26" [label="/__w/AtomVM/AtomVM/src/libAtomVM/resources.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/resources.c"] "72" [label="/__w/AtomVM/AtomVM/src/libAtomVM/resources.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/resources.h"] "51" [label="/__w/AtomVM/AtomVM/src/libAtomVM/scheduler.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/scheduler.h"] "40" [label="/__w/AtomVM/AtomVM/src/libAtomVM/stacktrace.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/stacktrace.c"] "39" [label="/__w/AtomVM/AtomVM/src/libAtomVM/stacktrace.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/stacktrace.h"] "41" [label="/__w/AtomVM/AtomVM/src/libAtomVM/sys.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/sys.h"] "35" [label="/__w/AtomVM/AtomVM/src/libAtomVM/term.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/term.c"] "65" [label="/__w/AtomVM/AtomVM/src/libAtomVM/term.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/term.h"] "75" [label="/__w/AtomVM/AtomVM/src/libAtomVM/unicode.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/unicode.c"] "76" [label="/__w/AtomVM/AtomVM/src/libAtomVM/utils.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/utils.c"] "1" [label="/__w/AtomVM/AtomVM/src/libAtomVM/utils.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/utils.h" fillcolor="#BFBFBF"] "77" [label="/__w/AtomVM/AtomVM/src/libAtomVM/valueshashtable.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/valueshashtable.c"] "4" -> "3" [dir=back tooltip="include"] "4" -> "5" [dir=back tooltip="include"] "4" -> "6" [dir=back tooltip="include"] "4" -> "33" [dir=back tooltip="include"] "4" -> "16" [dir=back tooltip="include"] "4" -> "36" [dir=back tooltip="include"] "4" -> "10" [dir=back tooltip="include"] "4" -> "35" [dir=back tooltip="include"] "7" -> "8" [dir=back tooltip="include"] "7" -> "5" [dir=back tooltip="include"] "7" -> "9" [dir=back tooltip="include"] "7" -> "10" [dir=back tooltip="include"] "13" -> "14" [dir=back tooltip="include"] "13" -> "15" [dir=back tooltip="include"] "13" -> "16" [dir=back tooltip="include"] "13" -> "10" [dir=back tooltip="include"] "62" -> "14" [dir=back tooltip="include"] "62" -> "63" [dir=back tooltip="include"] "62" -> "28" [dir=back tooltip="include"] "62" -> "33" [dir=back tooltip="include"] "62" -> "15" [dir=back tooltip="include"] "62" -> "64" [dir=back tooltip="include"] "62" -> "10" [dir=back tooltip="include"] "12" -> "13" [dir=back tooltip="include"] "12" -> "11" [dir=back tooltip="include"] "12" -> "17" [dir=back tooltip="include"] "12" -> "20" [dir=back tooltip="include"] "12" -> "21" [dir=back tooltip="include"] "12" -> "27" [dir=back tooltip="include"] "12" -> "28" [dir=back tooltip="include"] "12" -> "5" [dir=back tooltip="include"] "12" -> "29" [dir=back tooltip="include"] "12" -> "15" [dir=back tooltip="include"] "12" -> "9" [dir=back tooltip="include"] "12" -> "19" [dir=back tooltip="include"] "12" -> "16" [dir=back tooltip="include"] "12" -> "36" [dir=back tooltip="include"] "12" -> "10" [dir=back tooltip="include"] "12" -> "42" [dir=back tooltip="include"] "12" -> "34" [dir=back tooltip="include"] "12" -> "32" [dir=back tooltip="include"] "12" -> "22" [dir=back tooltip="include"] "12" -> "23" [dir=back tooltip="include"] "12" -> "49" [dir=back tooltip="include"] "12" -> "50" [dir=back tooltip="include"] "12" -> "47" [dir=back tooltip="include"] "12" -> "25" [dir=back tooltip="include"] "12" -> "26" [dir=back tooltip="include"] "12" -> "51" [dir=back tooltip="include"] "12" -> "39" [dir=back tooltip="include"] "12" -> "35" [dir=back tooltip="include"] "17" -> "18" [dir=back tooltip="include"] "17" -> "15" [dir=back tooltip="include"] "17" -> "19" [dir=back tooltip="include"] "53" -> "14" [dir=back tooltip="include"] "53" -> "11" [dir=back tooltip="include"] "53" -> "54" [dir=back tooltip="include"] "53" -> "20" [dir=back tooltip="include"] "53" -> "27" [dir=back tooltip="include"] "53" -> "28" [dir=back tooltip="include"] "53" -> "5" [dir=back tooltip="include"] "53" -> "33" [dir=back tooltip="include"] "53" -> "15" [dir=back tooltip="include"] "53" -> "9" [dir=back tooltip="include"] "53" -> "10" [dir=back tooltip="include"] "53" -> "34" [dir=back tooltip="include"] "53" -> "32" [dir=back tooltip="include"] "53" -> "22" [dir=back tooltip="include"] "53" -> "23" [dir=back tooltip="include"] "53" -> "49" [dir=back tooltip="include"] "53" -> "50" [dir=back tooltip="include"] "53" -> "24" [dir=back tooltip="include"] "53" -> "26" [dir=back tooltip="include"] "53" -> "40" [dir=back tooltip="include"] "53" -> "35" [dir=back tooltip="include"] "66" -> "14" [dir=back tooltip="include"] "66" -> "11" [dir=back tooltip="include"] "66" -> "54" [dir=back tooltip="include"] "66" -> "19" [dir=back tooltip="include"] "66" -> "10" [dir=back tooltip="include"] "66" -> "22" [dir=back tooltip="include"] "66" -> "25" [dir=back tooltip="include"] "55" -> "20" [dir=back tooltip="include"] "55" -> "5" [dir=back tooltip="include"] "55" -> "15" [dir=back tooltip="include"] "55" -> "10" [dir=back tooltip="include"] "21" -> "11" [dir=back tooltip="include"] "21" -> "20" [dir=back tooltip="include"] "21" -> "5" [dir=back tooltip="include"] "21" -> "9" [dir=back tooltip="include"] "21" -> "19" [dir=back tooltip="include"] "21" -> "10" [dir=back tooltip="include"] "21" -> "22" [dir=back tooltip="include"] "21" -> "23" [dir=back tooltip="include"] "21" -> "24" [dir=back tooltip="include"] "21" -> "25" [dir=back tooltip="include"] "21" -> "26" [dir=back tooltip="include"] "67" -> "27" [dir=back tooltip="include"] "67" -> "6" [dir=back tooltip="include"] "67" -> "10" [dir=back tooltip="include"] "56" -> "27" [dir=back tooltip="include"] "56" -> "57" [dir=back tooltip="include"] "68" -> "13" [dir=back tooltip="include"] "68" -> "55" [dir=back tooltip="include"] "68" -> "64" [dir=back tooltip="include"] "68" -> "36" [dir=back tooltip="include"] "68" -> "42" [dir=back tooltip="include"] "68" -> "38" [dir=back tooltip="include"] "68" -> "58" [dir=back tooltip="include"] "69" -> "20" [dir=back tooltip="include"] "69" -> "28" [dir=back tooltip="include"] "69" -> "16" [dir=back tooltip="include"] "69" -> "10" [dir=back tooltip="include"] "6" -> "7" [dir=back tooltip="include"] "6" -> "11" [dir=back tooltip="include"] "6" -> "12" [dir=back tooltip="include"] "6" -> "53" [dir=back tooltip="include"] "6" -> "20" [dir=back tooltip="include"] "6" -> "55" [dir=back tooltip="include"] "6" -> "56" [dir=back tooltip="include"] "6" -> "5" [dir=back tooltip="include"] "6" -> "9" [dir=back tooltip="include"] "6" -> "37" [dir=back tooltip="include"] "6" -> "19" [dir=back tooltip="include"] "6" -> "16" [dir=back tooltip="include"] "6" -> "36" [dir=back tooltip="include"] "6" -> "10" [dir=back tooltip="include"] "6" -> "34" [dir=back tooltip="include"] "6" -> "32" [dir=back tooltip="include"] "6" -> "44" [dir=back tooltip="include"] "6" -> "22" [dir=back tooltip="include"] "6" -> "45" [dir=back tooltip="include"] "6" -> "23" [dir=back tooltip="include"] "6" -> "46" [dir=back tooltip="include"] "6" -> "49" [dir=back tooltip="include"] "6" -> "50" [dir=back tooltip="include"] "6" -> "47" [dir=back tooltip="include"] "6" -> "24" [dir=back tooltip="include"] "6" -> "58" [dir=back tooltip="include"] "6" -> "26" [dir=back tooltip="include"] "6" -> "51" [dir=back tooltip="include"] "6" -> "40" [dir=back tooltip="include"] "6" -> "41" [dir=back tooltip="include"] "30" -> "31" [dir=back tooltip="include"] "30" -> "32" [dir=back tooltip="include"] "30" -> "22" [dir=back tooltip="include"] "30" -> "23" [dir=back tooltip="include"] "29" -> "14" [dir=back tooltip="include"] "29" -> "30" [dir=back tooltip="include"] "29" -> "33" [dir=back tooltip="include"] "29" -> "10" [dir=back tooltip="include"] "29" -> "34" [dir=back tooltip="include"] "29" -> "32" [dir=back tooltip="include"] "29" -> "22" [dir=back tooltip="include"] "29" -> "23" [dir=back tooltip="include"] "29" -> "24" [dir=back tooltip="include"] "29" -> "35" [dir=back tooltip="include"] "61" -> "14" [dir=back tooltip="include"] "61" -> "62" [dir=back tooltip="include"] "61" -> "60" [dir=back tooltip="include"] "61" -> "10" [dir=back tooltip="include"] "61" -> "35" [dir=back tooltip="include"] "61" -> "65" [dir=back tooltip="include"] "64" -> "12" [dir=back tooltip="include"] "64" -> "15" [dir=back tooltip="include"] "64" -> "9" [dir=back tooltip="include"] "64" -> "16" [dir=back tooltip="include"] "64" -> "36" [dir=back tooltip="include"] "64" -> "10" [dir=back tooltip="include"] "37" -> "9" [dir=back tooltip="include"] "71" -> "11" [dir=back tooltip="include"] "71" -> "12" [dir=back tooltip="include"] "71" -> "5" [dir=back tooltip="include"] "71" -> "6" [dir=back tooltip="include"] "71" -> "52" [dir=back tooltip="include"] "71" -> "10" [dir=back tooltip="include"] "71" -> "22" [dir=back tooltip="include"] "71" -> "49" [dir=back tooltip="include"] "71" -> "72" [dir=back tooltip="include"] "74" -> "11" [dir=back tooltip="include"] "74" -> "20" [dir=back tooltip="include"] "74" -> "21" [dir=back tooltip="include"] "74" -> "27" [dir=back tooltip="include"] "74" -> "28" [dir=back tooltip="include"] "74" -> "30" [dir=back tooltip="include"] "74" -> "15" [dir=back tooltip="include"] "74" -> "52" [dir=back tooltip="include"] "74" -> "19" [dir=back tooltip="include"] "74" -> "10" [dir=back tooltip="include"] "74" -> "22" [dir=back tooltip="include"] "74" -> "50" [dir=back tooltip="include"] "74" -> "25" [dir=back tooltip="include"] "74" -> "72" [dir=back tooltip="include"] "74" -> "40" [dir=back tooltip="include"] "74" -> "65" [dir=back tooltip="include"] "36" -> "13" [dir=back tooltip="include"] "36" -> "28" [dir=back tooltip="include"] "36" -> "15" [dir=back tooltip="include"] "36" -> "9" [dir=back tooltip="include"] "36" -> "37" [dir=back tooltip="include"] "36" -> "16" [dir=back tooltip="include"] "36" -> "10" [dir=back tooltip="include"] "36" -> "38" [dir=back tooltip="include"] "36" -> "39" [dir=back tooltip="include"] "36" -> "41" [dir=back tooltip="include"] "36" -> "35" [dir=back tooltip="include"] "42" -> "20" [dir=back tooltip="include"] "42" -> "15" [dir=back tooltip="include"] "42" -> "9" [dir=back tooltip="include"] "42" -> "16" [dir=back tooltip="include"] "42" -> "10" [dir=back tooltip="include"] "42" -> "34" [dir=back tooltip="include"] "42" -> "43" [dir=back tooltip="include"] "42" -> "32" [dir=back tooltip="include"] "42" -> "44" [dir=back tooltip="include"] "42" -> "22" [dir=back tooltip="include"] "42" -> "45" [dir=back tooltip="include"] "42" -> "23" [dir=back tooltip="include"] "42" -> "46" [dir=back tooltip="include"] "42" -> "47" [dir=back tooltip="include"] "42" -> "24" [dir=back tooltip="include"] "43" -> "34" [dir=back tooltip="include"] "44" -> "32" [dir=back tooltip="include"] "45" -> "22" [dir=back tooltip="include"] "45" -> "23" [dir=back tooltip="include"] "46" -> "23" [dir=back tooltip="include"] "70" -> "14" [dir=back tooltip="include"] "70" -> "27" [dir=back tooltip="include"] "38" -> "10" [dir=back tooltip="include"] "50" -> "31" [dir=back tooltip="include"] "50" -> "10" [dir=back tooltip="include"] "50" -> "32" [dir=back tooltip="include"] "50" -> "22" [dir=back tooltip="include"] "50" -> "23" [dir=back tooltip="include"] "50" -> "49" [dir=back tooltip="include"] "47" -> "48" [dir=back tooltip="include"] "58" -> "5" [dir=back tooltip="include"] "58" -> "10" [dir=back tooltip="include"] "58" -> "32" [dir=back tooltip="include"] "58" -> "22" [dir=back tooltip="include"] "58" -> "24" [dir=back tooltip="include"] "73" -> "5" [dir=back tooltip="include"] "73" -> "19" [dir=back tooltip="include"] "73" -> "22" [dir=back tooltip="include"] "73" -> "23" [dir=back tooltip="include"] "73" -> "25" [dir=back tooltip="include"] "73" -> "26" [dir=back tooltip="include"] "73" -> "65" [dir=back tooltip="include"] "72" -> "21" [dir=back tooltip="include"] "72" -> "5" [dir=back tooltip="include"] "72" -> "73" [dir=back tooltip="include"] "72" -> "26" [dir=back tooltip="include"] "51" -> "5" [dir=back tooltip="include"] "51" -> "15" [dir=back tooltip="include"] "51" -> "52" [dir=back tooltip="include"] "51" -> "10" [dir=back tooltip="include"] "51" -> "22" [dir=back tooltip="include"] "39" -> "15" [dir=back tooltip="include"] "39" -> "40" [dir=back tooltip="include"] "41" -> "11" [dir=back tooltip="include"] "41" -> "5" [dir=back tooltip="include"] "41" -> "9" [dir=back tooltip="include"] "41" -> "16" [dir=back tooltip="include"] "41" -> "10" [dir=back tooltip="include"] "41" -> "22" [dir=back tooltip="include"] "41" -> "26" [dir=back tooltip="include"] "65" -> "14" [dir=back tooltip="include"] "65" -> "62" [dir=back tooltip="include"] "65" -> "11" [dir=back tooltip="include"] "65" -> "12" [dir=back tooltip="include"] "65" -> "54" [dir=back tooltip="include"] "65" -> "66" [dir=back tooltip="include"] "65" -> "20" [dir=back tooltip="include"] "65" -> "55" [dir=back tooltip="include"] "65" -> "27" [dir=back tooltip="include"] "65" -> "67" [dir=back tooltip="include"] "65" -> "57" [dir=back tooltip="include"] "65" -> "56" [dir=back tooltip="include"] "65" -> "68" [dir=back tooltip="include"] "65" -> "28" [dir=back tooltip="include"] "65" -> "69" [dir=back tooltip="include"] "65" -> "5" [dir=back tooltip="include"] "65" -> "6" [dir=back tooltip="include"] "65" -> "31" [dir=back tooltip="include"] "65" -> "33" [dir=back tooltip="include"] "65" -> "29" [dir=back tooltip="include"] "65" -> "15" [dir=back tooltip="include"] "65" -> "64" [dir=back tooltip="include"] "65" -> "9" [dir=back tooltip="include"] "65" -> "19" [dir=back tooltip="include"] "65" -> "16" [dir=back tooltip="include"] "65" -> "36" [dir=back tooltip="include"] "65" -> "10" [dir=back tooltip="include"] "65" -> "34" [dir=back tooltip="include"] "65" -> "32" [dir=back tooltip="include"] "65" -> "22" [dir=back tooltip="include"] "65" -> "23" [dir=back tooltip="include"] "65" -> "70" [dir=back tooltip="include"] "65" -> "50" [dir=back tooltip="include"] "65" -> "58" [dir=back tooltip="include"] "65" -> "39" [dir=back tooltip="include"] "65" -> "35" [dir=back tooltip="include"] "1" -> "2" [dir=back tooltip="include"] "1" -> "3" [dir=back tooltip="include"] "1" -> "4" [dir=back tooltip="include"] "1" -> "8" [dir=back tooltip="include"] "1" -> "14" [dir=back tooltip="include"] "1" -> "11" [dir=back tooltip="include"] "1" -> "20" [dir=back tooltip="include"] "1" -> "57" [dir=back tooltip="include"] "1" -> "28" [dir=back tooltip="include"] "1" -> "5" [dir=back tooltip="include"] "1" -> "59" [dir=back tooltip="include"] "1" -> "33" [dir=back tooltip="include"] "1" -> "60" [dir=back tooltip="include"] "1" -> "61" [dir=back tooltip="include"] "1" -> "15" [dir=back tooltip="include"] "1" -> "71" [dir=back tooltip="include"] "1" -> "19" [dir=back tooltip="include"] "1" -> "74" [dir=back tooltip="include"] "1" -> "16" [dir=back tooltip="include"] "1" -> "10" [dir=back tooltip="include"] "1" -> "22" [dir=back tooltip="include"] "1" -> "25" [dir=back tooltip="include"] "1" -> "26" [dir=back tooltip="include"] "1" -> "35" [dir=back tooltip="include"] "1" -> "65" [dir=back tooltip="include"] "1" -> "75" [dir=back tooltip="include"] "1" -> "76" [dir=back tooltip="include"] "1" -> "77" [dir=back tooltip="include"] }

Misc functions and macros.

Miscellaneous functions and macros useful for different tasks, like endian byteswap, unaligned reads, marking unused vars, etc…

Defines

READ_32_ALIGNED(ptr)     ((((uint8_t *) (ptr))[0] << 24) | (((uint8_t *) (ptr))[1] << 16) | (((uint8_t *) (ptr))[2] << 8) | ((uint8_t *) (ptr))[3])
READ_64_UNALIGNED(ptr)     ((((uint64_t) ((uint8_t *) (ptr))[0]) << 56) | (((uint64_t) ((uint8_t *) (ptr))[1]) << 48) | (((uint64_t) ((uint8_t *) (ptr))[2]) << 40) | (((uint64_t) ((uint8_t *) (ptr))[3]) << 32) | (((uint64_t) ((uint8_t *) (ptr))[4]) << 24) | (((uint64_t) ((uint8_t *) (ptr))[5]) << 16) | (((uint64_t) ((uint8_t *) (ptr))[6]) << 8) | (((uint64_t) ((uint8_t *) (ptr))[7])))
WRITE_64_UNALIGNED(ptr, val)

{                                                             \

((uint8_t *) (ptr))[0] = (((uint64_t) val) >> 56) & 0xff; \

((uint8_t *) (ptr))[1] = (((uint64_t) val) >> 48) & 0xff; \

((uint8_t *) (ptr))[2] = (((uint64_t) val) >> 40) & 0xff; \

((uint8_t *) (ptr))[3] = (((uint64_t) val) >> 32) & 0xff; \

((uint8_t *) (ptr))[4] = (((uint64_t) val) >> 24) & 0xff; \

((uint8_t *) (ptr))[5] = (((uint64_t) val) >> 16) & 0xff; \

((uint8_t *) (ptr))[6] = (((uint64_t) val) >> 8) & 0xff;  \

((uint8_t *) (ptr))[7] = ((uint64_t) val) & 0xff;         \

}


READ_32_UNALIGNED(ptr)     ((((uint8_t *) (ptr))[0] << 24) | (((uint8_t *) (ptr))[1] << 16) | (((uint8_t *) (ptr))[2] << 8) | ((uint8_t *) (ptr))[3])
WRITE_32_UNALIGNED(ptr, val)

{                                                             \

((uint8_t *) (ptr))[0] = (((uint32_t) val) >> 24) & 0xff; \

((uint8_t *) (ptr))[1] = (((uint32_t) val) >> 16) & 0xff; \

((uint8_t *) (ptr))[2] = (((uint32_t) val) >> 8) & 0xff;  \

((uint8_t *) (ptr))[3] = ((uint32_t) val) & 0xff;         \

}


READ_16_UNALIGNED(ptr)     ((((uint8_t *) (ptr))[0] << 8) | ((uint8_t *) (ptr))[1])
WRITE_16_UNALIGNED(ptr, val)

{                                                            \

((uint8_t *) (ptr))[0] = (((uint16_t) val) >> 8) & 0xff; \

((uint8_t *) (ptr))[1] = ((uint16_t) val) & 0xff;        \

}


ENDIAN_SWAP_32(value) ((((value) &0xFF) << 24) | (((value) &0xFF00) << 8) | (((value) &0xFF0000) >> 8) | (((value) &0xFF000000) >> 24))
ENDIAN_SWAP_16(value) ((((value) &0xFF) << 8) | (((value) &0xFF00) >> 8))
UNUSED(x) (void) (x);
IS_NULL_PTR(x) ((x) == NULL)
LIKELY(x) (x)
UNLIKELY(x) (x)
HOT_FUNC
COLD_FUNC
MALLOC_LIKE
MUST_CHECK
AVM_ABORT() abort()
CAST_FUNC_TO_VOID_PTR(f) ((void *) (f))
CAST_VOID_TO_FUNC_PTR(f) ((func_ptr_t) (f))
CONTAINER_OF(ptr, type, member)     ((type *) (((char *) (ptr)) - offsetof(type, member)))
PRINTF_FORMAT_ARGS(...)
NO_DISCARD(...)
UNREACHABLE(...)
ASSUME(...)
MAXI(A, B) ((A > B) ? (A) : (B))
MINI(A, B) ((A > B) ? (B) : (A))
INTPTR_WRITE_TO_ASCII_BUF_LEN (32 + 1)

Required buffer size for intptr_t to ASCII conversion.

Defines the maximum buffer size needed to hold any intptr_t value converted to ASCII in any base (2-36), including sign character. This constant ensures safe buffer allocation for intptr_write_to_ascii_buf().

Note

Value depends on platform pointer size (33 bytes for 32-bit, 65 bytes for 64-bit)

Warning

Always use this constant to allocate buffers for intptr_write_to_ascii_buf()

INT32_WRITE_TO_ASCII_BUF_LEN (32 + 1)

Required buffer size for int32_t to ASCII conversion.

Defines the maximum buffer size needed to hold any int32_t value converted to ASCII in any base (2-36), including sign character. This constant ensures safe buffer allocation for int32_write_to_ascii_buf().

Note

Always 33 bytes (32 digits for base 2 plus sign)

Warning

Always use this constant to allocate buffers for int32_write_to_ascii_buf()

INT64_WRITE_TO_ASCII_BUF_LEN (64 + 1)

Required buffer size for int64_t to ASCII conversion.

Defines the maximum buffer size needed to hold any int64_t value converted to ASCII in any base (2-36), including sign character. This constant ensures safe buffer allocation for int64_write_to_ascii_buf().

Note

Always 65 bytes (64 digits for base 2 plus sign)

Warning

Always use this constant to allocate buffers for int64_write_to_ascii_buf()

Typedefs

typedef void (*func_ptr_t)(void)

Enums

enum buf_to_int64_options_t

Options for integer parsing behavior.

Controls how int64_parse_ascii_buf() handles signs and other parsing options. Options can be combined using bitwise OR.

Values:

enumerator BufToInt64NoOptions

Default parsing behavior - accepts signs (+/-)

enumerator BufToInt64RejectSign

Reject sign characters - parse unsigned magnitude only.

Functions

static inline size_t size_align_up_pow2(size_t n, size_t align)

Align size up to power-of-2 boundary.

Rounds up a size value to the next multiple of a power-of-2 alignment. This function uses bit manipulation for efficient alignment calculation and is faster than the general-purpose size_align_up().

size_t aligned = size_align_up_pow2(17, 8);  // Returns 24
size_t aligned = size_align_up_pow2(16, 8);  // Returns 16 (already aligned)

See also

size_align_up() for arbitrary alignment values

Note

Result is always >= n

Warning

Undefined behavior if align is not a power of 2

Warning

Undefined behavior if align is 0

Parameters:
  • n – Size value to align

  • align – Power-of-2 alignment boundary

Returns:

Size rounded up to next multiple of align

Pre:

align must be a power of 2 (e.g., 2, 4, 8, 16, 32, …)

static inline size_t size_align_up(size_t n, size_t align)

Align size up to arbitrary boundary.

Rounds up a size value to the next multiple of an alignment boundary. Works with any alignment value, not just powers of 2.

size_t aligned = size_align_up(17, 10);  // Returns 20
size_t aligned = size_align_up(20, 10);  // Returns 20 (already aligned)
size_t aligned = size_align_up(17, 0);   // Returns 17 (no alignment)

See also

size_align_up_pow2() for optimized power-of-2 alignment

See also

size_align_down() for rounding down instead of up

Note

Returns n unchanged if align is 0 (no alignment)

Note

Result is always >= n

Note

For power-of-2 alignments, size_align_up_pow2() is more efficient

Parameters:
  • n – Size value to align

  • align – Alignment boundary (any positive value, or 0)

Returns:

Size rounded up to next multiple of align, or n if align is 0

static inline size_t size_align_down(size_t n, size_t align)

Align size down to arbitrary boundary.

Rounds down a size value to the previous multiple of an alignment boundary. Works with any alignment value, not just powers of 2.

size_t aligned = size_align_down(17, 10);  // Returns 10
size_t aligned = size_align_down(20, 10);  // Returns 20 (already aligned)
size_t aligned = size_align_down(7, 10);   // Returns 0

See also

size_align_up() for rounding up instead of down

Note

Returns n unchanged if align is 0 (no alignment)

Note

Result is always <= n

Note

Commonly used for finding aligned base addresses within buffers

Parameters:
  • n – Size value to align

  • align – Alignment boundary (any positive value, or 0)

Returns:

Size rounded down to previous multiple of align, or n if align is 0

static inline int32_t int32_neg_unsigned(uint32_t u32)

Negate unsigned 32-bit value (uint32_t) to signed integer (int32_t)

Converts an unsigned 32-bit value to its negated signed representation. This function performs the negation operation while avoiding undefined behavior that would occur with direct cast and negation due to two’s complement asymmetry.

Note

Handles INT32_MIN case correctly (u32 = 2147483648 returns -2147483648)

Note

Useful for parsing negative integers from text where magnitude is parsed as unsigned to avoid overflow

Warning

Values greater than 2147483648 have undefined results

Parameters:
  • u32 – Unsigned 32-bit value to negate

Returns:

Negated value as signed 32-bit integer (int32_t)

static inline int64_t int64_neg_unsigned(uint64_t u64)

Negate unsigned 64-bit value (uint64_t) to signed integer (int64_t)

Converts an unsigned 64-bit value to its negated signed representation. This function performs the negation operation while avoiding undefined behavior that would occur with direct cast and negation due to two’s complement asymmetry.

Note

Handles INT64_MIN case correctly (u64 = 9223372036854775808 returns INT64_MIN)

Note

Useful for parsing negative integers from text where magnitude is parsed as unsigned to avoid overflow

Warning

Values greater than 9223372036854775808 have undefined results

Parameters:
  • u64 – Unsigned 64-bit value to negate

Returns:

Negated value as signed 64-bit integer (int64_t)

static inline int32_t int32_cond_neg_unsigned(bool negative, uint32_t u32)

Conditionally negate unsigned 32-bit value (uint32_t) to signed integer (int32_t)

Converts an unsigned 32-bit value to signed, optionally negating based on a flag. This function safely handles the negation while avoiding undefined behavior from two’s complement asymmetry. Commonly used when parsing integers where the sign is determined separately from the magnitude.

See also

uint32_does_overflow_int32() to check for overflow before conversion

See also

int32_neg_unsigned() for unconditional negation

Warning

Caller must ensure the value fits in signed range using uint32_does_overflow_int32() before calling this function

Parameters:
  • negative – If true, negate the value; if false, cast directly to signed

  • u32 – Unsigned 32-bit magnitude

Returns:

Signed 32-bit integer (int32_t), negated if negative flag is true

static inline int64_t int64_cond_neg_unsigned(bool negative, uint64_t u64)

Conditionally negate unsigned 64-bit value (uint64_t) to signed integer (int64_t)

Converts an unsigned 64-bit value to signed, optionally negating based on a flag. This function safely handles the negation while avoiding undefined behavior from two’s complement asymmetry. Commonly used when parsing integers where the sign is determined separately from the magnitude.

See also

uint64_does_overflow_int64() to check for overflow before conversion

See also

int64_neg_unsigned() for unconditional negation

Warning

Caller must ensure the value fits in signed range using uint64_does_overflow_int64() before calling this function

Parameters:
  • negative – If true, negate the value; if false, cast directly to signed

  • u64 – Unsigned 64-bit magnitude

Returns:

Signed 64-bit integer (int64_t), negated if negative flag is true

static inline bool uint32_does_overflow_int32(uint32_t u32, bool is_negative)

Check if unsigned 32-bit value (uint32_t) would overflow when converted to signed (int32_t)

Tests whether an unsigned 32-bit value can be represented as a signed 32-bit integer, accounting for whether it will be negated. Negative values can represent one more magnitude (INT32_MIN = -2147483648) than positive values (INT32_MAX = 2147483647).

See also

int32_cond_neg_unsigned() to perform the conversion after checking

Note

Maximum representable positive: 2147483647 (INT32_MAX)

Note

Maximum representable negative magnitude: 2147483648 (|INT32_MIN|)

Parameters:
  • u32 – Unsigned magnitude to check

  • is_negative – Whether the value will be negated

Returns:

true if conversion would overflow, false if safe to convert

static inline bool uint64_does_overflow_int64(uint64_t u64, bool is_negative)

Check if unsigned 64-bit value (uint64_t) would overflow when converted to signed (int64_t)

Tests whether an unsigned 64-bit value can be represented as a signed 64-bit integer, accounting for whether it will be negated. Negative values can represent one more magnitude (INT64_MIN) than positive values (INT64_MAX).

See also

int64_cond_neg_unsigned() to perform the conversion after checking

Note

Maximum representable positive: 9223372036854775807 (INT64_MAX)

Note

Maximum representable negative magnitude: 9223372036854775808 (|INT64_MIN|)

Parameters:
  • u64 – Unsigned magnitude to check

  • is_negative – Whether the value will be negated

Returns:

true if conversion would overflow, false if safe to convert

static inline uint32_t int32_safe_unsigned_abs(int32_t i32)

Compute absolute value of signed 32-bit integer (int32_t) as unsigned (uint32_t)

Returns the absolute value of a signed 32-bit integer (int32_t) as an unsigned 32-bit value (uint32_t). This function avoids undefined behavior that would occur when negating INT32_MIN in signed arithmetic.

Note

Handles INT32_MIN correctly (returns 2147483648 as unsigned)

Note

Caller can use result without concern for undefined behavior

Parameters:
  • i32 – Signed integer (int32_t) to get absolute value of

Returns:

Absolute value as unsigned 32-bit integer (uint32_t)

static inline uint64_t int64_safe_unsigned_abs(int64_t i64)

Compute absolute value of signed 64-bit integer (int64_t) as unsigned (uint64_t)

Returns the absolute value of a signed 64-bit integer (int64_t) as an unsigned 64-bit value (uint64_t). This function avoids undefined behavior that would occur when negating INT64_MIN in signed arithmetic.

Note

Handles INT64_MIN correctly (returns 9223372036854775808 as unsigned)

Note

Caller can use result without concern for undefined behavior

Parameters:
  • i64 – Signed integer (int64_t) to get absolute value of

Returns:

Absolute value as unsigned 64-bit integer (uint64_t)

static inline int32_t int32_bsr(int32_t n, size_t rshift)

Perform arithmetic right shift on 32-bit signed integer (int32_t)

Performs a portable arithmetic right shift that preserves sign extension across different compilers and architectures. Unlike the C >> operator on signed integers (which has implementation-defined behavior for negative values), this function guarantees arithmetic shift semantics.

See also

int32_bsr_safe() for safe version with large shift handling

Note

Negative values are sign-extended (arithmetic shift)

Note

Positive values are zero-extended (logical shift)

Note

Portable replacement for implementation-defined signed right shift

Warning

For shift amounts >= 32, behavior is undefined. Use int32_bsr_safe() for defined behavior with large shift amounts

Parameters:
  • n – Signed 32-bit integer (int32_t) to shift

  • rshift – Number of bit positions to shift right

Returns:

Right-shifted value with sign extension preserved

static inline int64_t int64_bsr(int64_t n, size_t rshift)

Perform arithmetic right shift on 64-bit signed integer (int64_t)

Performs a portable arithmetic right shift that preserves sign extension across different compilers and architectures. Unlike the C >> operator on signed integers (which has implementation-defined behavior for negative values), this function guarantees arithmetic shift semantics.

See also

int64_bsr_safe() for safe version with large shift handling

Note

Negative values are sign-extended (arithmetic shift)

Note

Positive values are zero-extended (logical shift)

Note

Portable replacement for implementation-defined signed right shift

Warning

For shift amounts >= 64, behavior is undefined. Use int64_bsr_safe() for defined behavior with large shift amounts

Parameters:
  • n – Signed 64-bit integer (int64_t) to shift

  • rshift – Number of bit positions to shift right

Returns:

Right-shifted value with sign extension preserved

static inline int32_t int32_bsr_safe(int32_t n, size_t rshift)

Safely perform arithmetic right shift on 32-bit signed integer (int32_t)

Performs a portable arithmetic right shift with defined behavior for shift amounts >= 32 bits. This follows Erlang’s semantics where right shifts beyond the bit width converge to -1 for negative values and 0 for non-negative values.

See also

int32_bsr() for version without large shift protection

Note

For rshift >= 32: returns -1 if n < 0, returns 0 if n >= 0

Note

For rshift < 32: performs standard arithmetic right shift

Note

Erlang-inspired semantics for large shifts

Parameters:
  • n – Signed 32-bit integer (int32_t) to shift

  • rshift – Number of bit positions to shift right

Returns:

Right-shifted value, or -1 (negative) / 0 (non-negative) for shifts >= 32

static inline int64_t int64_bsr_safe(int64_t n, size_t rshift)

Safely perform arithmetic right shift on 64-bit signed integer (int64_t)

Performs a portable arithmetic right shift with defined behavior for shift amounts >= 64 bits. This follows Erlang’s semantics where right shifts beyond the bit width converge to -1 for negative values and 0 for non-negative values.

See also

int64_bsr() for version without large shift protection

Note

For rshift >= 64: returns -1 if n < 0, returns 0 if n >= 0

Note

For rshift < 64: performs standard arithmetic right shift

Note

Erlang-inspired semantics for large shifts

Parameters:
  • n – Signed 64-bit integer (int64_t) to shift

  • rshift – Number of bit positions to shift right

Returns:

Right-shifted value, or -1 (negative) / 0 (non-negative) for shifts >= 64

static inline bool int32_bsl_overflow(int32_t n, size_t lshift, int32_t *out)

Perform left shift on 32-bit signed integer (int32_t) with overflow detection.

Performs a left shift operation with overflow detection. The shift is always defined (even for shift amounts >= 32), and the function reports whether the operation would lose information. This provides safe, portable bit shifting with predictable overflow semantics.

See also

int32_bsr() used internally for overflow checking

Note

For lshift >= 32: sets *out to 0, returns true if n != 0

Note

For lshift < 32: performs shift and checks if reversible

Parameters:
  • n – Signed 32-bit integer (int32_t) to shift

  • lshift – Number of bit positions to shift left

  • out[out] Result of the shift operation (0 for shifts >= 32)

Returns:

true if overflow occurred (information lost), false if exact

Pre:

out != NULL

static inline bool int64_bsl_overflow(int64_t n, size_t lshift, int64_t *out)

Perform left shift on 64-bit signed integer (int64_t) with overflow detection.

Performs a left shift operation with overflow detection. The shift is always defined (even for shift amounts >= 64), and the function reports whether the operation would lose information. This provides safe, portable bit shifting with predictable overflow semantics.

See also

int64_bsr() used internally for overflow checking

Note

For lshift >= 64: sets *out to 0, returns true if n != 0

Note

For lshift < 64: performs shift and checks if reversible

Note

Overflow detection works by shifting back and comparing with original

Parameters:
  • n – Signed 64-bit integer (int64_t) to shift

  • lshift – Number of bit positions to shift left

  • out[out] Result of the shift operation (0 for shifts >= 64)

Returns:

true if overflow occurred (information lost), false if exact

Pre:

out != NULL

size_t intptr_write_to_ascii_buf(intptr_t n, unsigned int base, char *out_end)

Convert intptr_t to ASCII representation in specified base.

Writes the ASCII representation of a signed integer to a buffer, starting from the end and working backwards. The function returns the number of characters written. This design allows efficient conversion without requiring string reversal.

char buffer[INTPTR_WRITE_TO_ASCII_BUF_LEN];
size_t len = intptr_write_to_ascii_buf(-42, 10, buffer + INTPTR_WRITE_TO_ASCII_BUF_LEN);
// Characters written at: buffer + INTPTR_WRITE_TO_ASCII_BUF_LEN - len
// Result: "-42" (3 characters)

Note

Optimized implementations for base 10 and base 16

Note

Negative numbers include leading ‘-’ character

Note

Digits > 9 represented as uppercase letters (A-Z)

Warning

Buffer must be at least INTPTR_WRITE_TO_ASCII_BUF_LEN bytes

Warning

Insufficient buffer size causes undefined behavior (buffer overflow)

Warning

Caller must add null terminator if using result as C string

Parameters:
  • n – Integer value (intptr_t) to convert

  • base – Number base for conversion (2-36)

  • out_end – Pointer to one-past-last position of output buffer

Returns:

Number of characters written to buffer

Pre:

base >= 2 && base <= 36

Pre:

out_end points to valid buffer with at least INTPTR_WRITE_TO_ASCII_BUF_LEN bytes before it

Post:

Characters written to [(out_end - return_value), out_end)

Post:

No null terminator is added

static inline size_t int32_write_to_ascii_buf(int32_t n, unsigned int base, char *out_end)

Convert int32_t to ASCII representation in specified base.

Writes the ASCII representation of a 32-bit signed integer to a buffer, starting from the end and working backwards. The function returns the number of characters written. This design allows efficient conversion without requiring string reversal.

char buffer[INT32_WRITE_TO_ASCII_BUF_LEN];
size_t len = int32_write_to_ascii_buf(-42, 10, buffer + INT32_WRITE_TO_ASCII_BUF_LEN);
// Characters written at: buffer + INT32_WRITE_TO_ASCII_BUF_LEN - len
// Result: "-42" (3 characters)

Note

Optimized implementations for base 10 and base 16

Note

Negative numbers include leading ‘-’ character

Note

Digits > 9 represented as uppercase letters (A-Z)

Warning

Buffer must be at least INT32_WRITE_TO_ASCII_BUF_LEN bytes

Warning

Insufficient buffer size causes undefined behavior (buffer overflow)

Warning

Caller must add null terminator if using result as C string

Parameters:
  • n – Integer value (int32_t) to convert

  • base – Number base for conversion (2-36)

  • out_end – Pointer to one-past-last position of output buffer

Returns:

Number of characters written to buffer

Pre:

base >= 2 && base <= 36

Pre:

out_end points to valid buffer with at least INT32_WRITE_TO_ASCII_BUF_LEN bytes before it

Post:

Characters written to [(out_end - return_value), out_end)

Post:

No null terminator is added

static inline size_t int64_write_to_ascii_buf(int64_t n, unsigned int base, char *out_end)

Convert int64_t to ASCII representation in specified base.

Writes the ASCII representation of a 64-bit signed integer to a buffer, starting from the end and working backwards. The function returns the number of characters written. This design allows efficient conversion without requiring string reversal.

char buffer[INT64_WRITE_TO_ASCII_BUF_LEN];
size_t len = int64_write_to_ascii_buf(INT64_MIN, 10, buffer + INT64_WRITE_TO_ASCII_BUF_LEN);
// Characters written at: buffer + INT64_WRITE_TO_ASCII_BUF_LEN - len
// Result: "-9223372036854775808" (20 characters)

Note

Optimized implementations for base 10 and base 16

Note

Negative numbers include leading ‘-’ character

Note

Digits > 9 represented as uppercase letters (A-Z)

Warning

Buffer must be at least INT64_WRITE_TO_ASCII_BUF_LEN bytes

Warning

Insufficient buffer size causes undefined behavior (buffer overflow)

Warning

Caller must add null terminator if using result as C string

Parameters:
  • n – Integer value (int64_t) to convert

  • base – Number base for conversion (2-36)

  • out_end – Pointer to one-past-last position of output buffer

Returns:

Number of characters written to buffer

Pre:

base >= 2 && base <= 36

Pre:

out_end points to valid buffer with at least INT64_WRITE_TO_ASCII_BUF_LEN bytes before it

Post:

Characters written to [(out_end - return_value), out_end)

Post:

No null terminator is added

int int64_parse_ascii_buf(const char buf[], size_t buf_len, unsigned int base, buf_to_int64_options_t options, int64_t *out)

Parse ASCII buffer to int64_t in specified base.

Parses an ASCII representation of an integer from a buffer (not necessarily null-terminated) into a 64-bit signed integer. Supports bases 2-36 with optimized paths for base 10 and 16. The function is designed to support parsing arbitrarily large integers by processing them in chunks - it returns the position where parsing stopped, allowing callers to continue parsing from that point.

// Simple parsing
int64_t value;
const char *number = "12345";
int pos = int64_parse_ascii_buf(number, strlen(number), 10, BufToInt64NoOptions, &value);
if (pos == strlen(number)) {
    // Successfully parsed entire buffer: value = 12345
}

// Parsing with overflow detection
const char *big_num = "99999999999999999999999";
int pos = int64_parse_ascii_buf(big_num, strlen(big_num), 10, BufToInt64NoOptions, &value);
if (pos < strlen(big_num)) {
    // Overflow occurred at position pos
    // value contains the maximum representable value before overflow
}

// Chunk parsing for arbitrarily large integers
const char *chunks[] = {"12345", "67890", "12345"};
int64_t accumulated = 0;
for (int i = 0; i < 3; i++) {
    int64_t chunk;
    int pos = int64_parse_ascii_buf(chunks[i], 5, 10, BufToInt64RejectSign, &chunk);
    // Process chunk value...
}

See also

int64_write_to_ascii_buf() for the inverse operation

Note

Leading zeros are skipped automatically

Note

Signs (+/-) accepted unless BufToInt64RejectSign is set

Note

Case-insensitive for letter digits (a-z, A-Z)

Note

Optimized implementations for base 10 and base 16

Note

Stops parsing at first invalid character or overflow

Warning

Return value -1 indicates format error (invalid digit for base)

Warning

Return value < buf_len may indicate overflow or invalid character

Parameters:
  • buf – Buffer containing ASCII digits to parse

  • buf_len – Length of buffer in bytes

  • base – Number base for parsing (2-36)

  • options – Parsing options (e.g., reject sign characters)

  • out[out] Parsed integer value (valid even on overflow)

Returns:

Position after last successfully parsed character, or -1 on format error

Pre:

base >= 2 && base <= 36

Pre:

buf != NULL when buf_len > 0 (NULL allowed only for zero-length buffer)

Pre:

out != NULL

Post:

On success: *out contains parsed value up to position returned

Post:

On overflow: *out contains value parsed before overflow, returns position where overflow occurred

Post:

On format error: returns -1, *out is undefined