Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/TakehideSoh/SAF
18 January 2026, 11:53:51 UTC
  • Code
  • Branches (4)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/dev
    • refs/heads/main
    • refs/tags/v1.0-cmsb2023
    • refs/tags/v1.1-CMSB2023
    • d26cc9f94a4f79c046ee0cdd3a127a44f7b443b6
    No releases to show
  • 83aaea6
  • /
  • bdd_minisat_all-1.0.2
  • /
  • trie.h
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:2c9df9567224e69c166e7a499749f43b9c8ffc0b
origin badgedirectory badge
swh:1:dir:e4b48dfb354d10699e262001c0cd6416edb3f793
origin badgerevision badge
swh:1:rev:d26cc9f94a4f79c046ee0cdd3a127a44f7b443b6
origin badgesnapshot badge
swh:1:snp:d3fcf0e446f52630e867f11dee4c2c828bf46951

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: d26cc9f94a4f79c046ee0cdd3a127a44f7b443b6 authored by TakehideSoh on 23 June 2023, 07:02:26 UTC
Merge pull request #2 from TakehideSoh/dev
Tip revision: d26cc9f
trie.h
/** \file       trie.h
 *  \brief      trie
 *  \author     Takahisa Toda
 *  \note
 *  - Iterative implementation is selected in default setting.
 *  - Define TRIE_REC if recursive implementation is preferable. In that case, please take care of stack overflow.
 */
#ifndef TRIE_H
#define TRIE_H

#include <stdint.h>
#include <assert.h>

#define WORDSIZE   (sizeof(unsigned int)*8)
static inline int  GET_NWORDS       (int len)                {return len > 0? (len-1)/WORDSIZE + 1: 0;}  // len: #bits
static inline int  DIGIT            (unsigned int *v, int i) {return (v[i/WORDSIZE] >> (i%WORDSIZE))%2;} // 0 <= i < #bits
static inline void SET_DIGIT        (unsigned int *v, int i) {v[i/WORDSIZE] |=   1U << (i%WORDSIZE);}
static inline void UNSET_DIGIT      (unsigned int *v, int i) {v[i/WORDSIZE] &= ~(1U << (i%WORDSIZE));}
static inline void UNSET_ALL_DIGIT  (unsigned int *v, int len) {int size = GET_NWORDS(len); for(int j = 0; j < size; j++) v[j] = 0;}

/*---------------------------------------------------------------------------*/
/* Type declarations                                                         */
/*---------------------------------------------------------------------------*/


typedef struct trie_node st_node;

/* \brief  trie*/
typedef struct st_trie {
    int             len;    //!< length of a bitvector
    st_node*        root;   //!< root node of a trie
    struct st_trie* nx;     //!< used for memory management purpose
    struct st_trie* pv;     //!< used for memory management purpose
} trie_t;


/*---------------------------------------------------------------------------*/
/* Function prototypes                                                       */
/*---------------------------------------------------------------------------*/

/* \brief Finalize node management.
 * \note
 * - trie nodes and bit vectors are cleared.
 * - trie_t data structure is not cleared for a later use!
 * - Call trie_delete to destroy trie_t data structure.
 */
extern void     trie_finalize(void);

/* \brief Setup node management. If tries are already created, they are initialized.
 * \note 
 * - Call pior to any other function calls. 
 * - This can be also used to clear all existing tries, where length of each trie will not be changed.
 */
extern void     trie_initialize(void);

/* \brief   Create an empty trie.
 * \param   n   Length of a bitvector
 * \return  Created trie.
 */
extern trie_t*  trie_create  (int n);

/* \brief delete a specified trie.
 * \note to finish the usage of trie completely, call trie_finalize.
 */
extern void     trie_delete(trie_t *t);

/*  \brief  Insert a new node in a trie.
 *  \param  k   Bitvector(key), where the first bit is k[0] and the final bit is k[t->len-1].
 *  \param  v   Value associated with the bitvector
 *  \param  t   Trie
 */
extern void     trie_insert   (unsigned int *k, uintptr_t v, trie_t *t);


/*  \brief  Search a node with a specified key.
 *  \param  k   Bitvector(key), where the first bit is k[0] and the final bit is k[t->len-1].
 *  \param  t   Trie
 *  \return Associated value if a node is found; otherwise, (uintptr_t)NULL.
 */
extern uintptr_t    trie_search   (unsigned int *k, trie_t *t);

#ifdef TRIE_REC
/*  \brief  Print a trie structure in a dot format (for debug).
 *  \param  t   Trie
 *  \param  out File pointer
 */
extern void     trie_print    (trie_t *t, FILE *out);
#endif

#endif /*TRIE_H*/

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API