-/* This only works for static symbols. */
-/* FIXME: should be called StaticSymbolFunction, right? */
-#define SymbolFunction(sym) \
- (((struct fdefn *)(SymbolValue(sym)-type_OtherPointer))->function)
+/* Is the Lisp object obj something with pointer nature (as opposed to
+ * e.g. a fixnum or character or unbound marker)? */
+static inline int
+is_lisp_pointer(lispobj obj)
+{
+#if N_WORD_BITS == 64
+ return (obj & 3) == 3;
+#else
+ return obj & 1;
+#endif
+}
+
+#include "fixnump.h"
+
+/* Is the Lisp object obj something with immediate nature (e.g. a
+ * fixnum or character or unbound marker)? */
+static inline int
+is_lisp_immediate(lispobj obj)
+{
+ return (fixnump(obj)
+ || (widetag_of(obj) == CHARACTER_WIDETAG)
+#if N_WORD_BITS == 64
+ || (widetag_of(obj) == SINGLE_FLOAT_WIDETAG)
+#endif
+ || (widetag_of(obj) == UNBOUND_MARKER_WIDETAG));
+}
+
+/* Convert from a lispobj with type bits to a native (ordinary
+ * C/assembly) pointer to the beginning of the object. */
+static inline lispobj *
+native_pointer(lispobj obj)
+{
+ return (lispobj *) ((pointer_sized_uint_t) (obj & ~LOWTAG_MASK));
+}
+
+/* inverse operation: create a suitably tagged lispobj from a native
+ * pointer or integer.*/
+static inline lispobj
+make_lispobj(void *o, int low_tag)
+{
+ return LOW_WORD(o) | low_tag;
+}
+
+#define MAKE_FIXNUM(n) (n << N_FIXNUM_TAG_BITS)
+static inline lispobj
+make_fixnum(sword_t n)
+{
+ return MAKE_FIXNUM(n);
+}
+
+static inline sword_t
+fixnum_value(lispobj n)
+{
+ return n >> N_FIXNUM_TAG_BITS;
+}
+
+#if defined(LISP_FEATURE_WIN32)
+/* KLUDGE: Avoid double definition of boolean by rpcndr.h included via
+ * shlobj.h.
+ *
+ * FIXME: We should probably arrange to use the rpcndr.h boolean on Windows,
+ * or get rid of our own boolean type. If the boolean type is only used in
+ * the runtime, and never passed to Lisp, then it doesn't matter which one
+ * we use.
+ */
+#define boolean rpcndr_boolean
+#include <shlobj.h>
+#undef boolean
+#endif
+typedef int boolean;
+
+static inline boolean
+other_immediate_lowtag_p(lispobj header)
+{
+ /* These lowtags are spaced 4 apart throughout the lowtag space. */
+ return (lowtag_of(header) & 3) == OTHER_IMMEDIATE_0_LOWTAG;
+}