Ruby: prism/util/pm_state_stack.c Source File

Ruby 3.3.4p94 (2024-07-09 revision be1089c8ec5ba40e09b1553e36b3174bf4014d9d)

pm_state_stack.c
1#include "prism/util/pm_state_stack.h"
2
6void
7pm_state_stack_push(pm_state_stack_t *stack, bool value) {
8 *stack = (*stack << 1) | (value & 1);
9}
10
14void
15pm_state_stack_pop(pm_state_stack_t *stack) {
16 *stack >>= 1;
17}
18
22bool
23pm_state_stack_p(pm_state_stack_t *stack) {
24 return *stack & 1;
25}
pm_state_stack.h
A stack of boolean values.
pm_state_stack_t
uint32_t pm_state_stack_t
A struct that represents a stack of boolean values.
Definition pm_state_stack.h:17