Files
Kevin Newton 4f6a7e0fa9 [ruby/prism] Serialize using post-order traversal
This makes it so that you do not have to recurse when serializing
and deserializing, making this safe for deep trees.

https://github.com/ruby/prism/commit/ab92f0eb4b
2026-10-20 21:02:33 +00:00

27 lines
872 B
C

/**
* @file compiler/branch.h
*/
#ifndef PRISM_COMPILER_BRANCH_H
#define PRISM_COMPILER_BRANCH_H
/**
* Branch prediction hints. These tell the compiler which side of a branch to
* predicate the fast path through, so it can lay out instructions to favour
* that side and steer the static branch predictor.
*/
#if defined(__GNUC__) || defined(__clang__)
/** The compiler should predicate that this branch will be taken. */
#define PRISM_LIKELY(x) __builtin_expect(!!(x), 1)
/** The compiler should predicate that this branch will not be taken. */
#define PRISM_UNLIKELY(x) __builtin_expect(!!(x), 0)
#else
/** Void because this platform does not support branch prediction hints. */
#define PRISM_LIKELY(x) (x)
/** Void because this platform does not support branch prediction hints. */
#define PRISM_UNLIKELY(x) (x)
#endif
#endif