Skip to content

Introduce nob_da_lower_bound(), nob_da_insert_at(), nob_swap_auto()#231

Open
theg4sh wants to merge 1 commit intotsoding:mainfrom
theg4sh:feat-da-lower-bound
Open

Introduce nob_da_lower_bound(), nob_da_insert_at(), nob_swap_auto()#231
theg4sh wants to merge 1 commit intotsoding:mainfrom
theg4sh:feat-da-lower-bound

Conversation

@theg4sh
Copy link
Copy Markdown

@theg4sh theg4sh commented Apr 5, 2026

Hi.

This change was realized under a pet project for analyzing of /var/log/auth.log for failed user's authentification with calculate of statistics by each IP.

PR is introduce NOB_TYPEOF which is supported since C99.
I don't sure that it is fully supported by all of compiler, but makes possible for swapping two elements without passing a type and gives simplier API of da_insert_at().

This PR gives possibility for the cases of:

  • producing ordered dynamic array of unique elements
  • effectively search with O(log(N)) inside of ordered dynamic array an element by it's property (in case of struct types).

@theg4sh theg4sh changed the title nob.h: Introduce nob_da_lower_bound(), nob_da_insert_at(), nob_swap_auto() Introduce nob_da_lower_bound(), nob_da_insert_at(), nob_swap_auto() Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant