summaryrefslogtreecommitdiff
path: root/vere/pkg/noun/jets/d/in_wyt.c
blob: 2ae72fa26576f6fd52dda2a7dafa81741cac905c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/// @file

#include "jets/q.h"
#include "jets/w.h"

#include "noun.h"

STATIC_ASSERT( (UINT32_MAX > u3a_cells),
               "width precision" );

static c3_w
_wyt_in(u3_noun a)
{
  if ( u3_nul == a ) {
    return 0;
  }
  else {
    u3_noun l_a, r_a;
    u3x_trel(a, 0, &l_a, &r_a);

    return 1 + _wyt_in(l_a) + _wyt_in(r_a);
  }
}

u3_noun
u3qdi_wyt(u3_noun a)
{
  return u3i_word(_wyt_in(a));
}

u3_noun
u3wdi_wyt(u3_noun cor)
{
  return u3qdi_wyt(u3x_at(u3x_con_2, cor));
}