preciz
Abit - functions to work with :atomics as a bit array (?)
I have extracted this small package from one of my hobby projects.
If anybody is comfortable with bitmasks or Elxir.Bitwise it would be cool to receive some feedback on this.
I’m not sure about a few naming and the complexity of the code when I’m setting a bit with Abit.set_bit/3.
GitHub: https://github.com/preciz/abit
Hexdocs: https://hexdocs.pm/abit
It’s main use case is if you use an :atomics array as a bit array.
Most Liked
preciz
I have added a module Abit.Counter.
This is similar to Erlang :counters but it allows you to use counters with smaller than 64 bit sizes:
bits | unsigned value range | signed value range
2 0..3 -2..1
4 0..15 -8..7
8 0..255 -128..127
16 0..65535 -32768..32767
32 0..4294967295 -2147483648..2147483647
So for example if you only need max value 255 (8 bits) unsigned, you can have atomics_size * 8 counters instead of just atomics_size.
Here is the short summary of the API of Abit.Counter module:
Abit.Counter
-
Abit.Counter.new/2- Create a new array of counters. Returns %Abit.Counter{} struct. -
Abit.Counter.get/2- Returns the value of counter at the given index. -
Abit.Counter.put/3- Puts the value into counter at the given index. -
Abit.Counter.add/3- Adds the increment to counter at the given index.
1
Popular in Libraries
Hey everyone :wave:
Excited to join this forum - I am one of the founders and current project maintainers of a popular and open-source U...
New
I’ve just released stable versions of my Prometheus Elixir libs:
Elixir client [docs];
Ecto collector [docs];
Plugs instrumenter/Export...
New
Hey everyone!
Well, we made this lib a while ago and now we decided to finally go out and public with it! It’s a tool for creating and m...
New
parameterized pipe in elixir: |n>
edit: negative index in |n> and mixed usage with |> are supported
example:
use ParamP...
New
Presenting Aviacommerce, open source e-commerce platform in Elixir
Aviacommerce is an open source e-commerce platform in Elixir. We at...
New
I’ve just released version 3 of Comeonin, a password hashing library.
The following small changes have been made:
changes to the NIF c...
New
After working on it for a couple of months and using it in production for most of that time, today I’ve released LiveAdmin, a LiveView ba...
New
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch.
This project took far...
New
I created a new library (rather I pulled out a couple files from my big project), it manages an operating system PID file for the BEAM.
...
New
Hello!
Came here to announce ChromicPDF, a pet project PDF generator I’ve been working on for the past few months. Why another PDF gener...
New
Other popular topics
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
can someone please explain to me how Enum.reduce works with maps
New
I couldn’t find any guides that worked well with Phoenix 1.6.0 and esbuild. I hope this helps people test the waters and eases you into t...
New
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine)
This is a plugin that adds support for Elixir to JetBrains IntelliJ...
New
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
The Elixir Typespec docs show the following syntax for keyword lists in typespecs:
# ...
| [key: type] # keyword lis...
New
Hi all,
I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage.
I'm trying to use Postg...
New
Hi guys, i’m new in the Elixir world, and i have to say, that i love it!
i’m having some problem to understand anonymous functions with ...
New
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New







