X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=blobdiff_plain;f=include%2Fcln%2Fobject.h;h=61a614eb5239d969f3ccdad231fe26e062863280;hb=HEAD;hp=3f5db3c0053e5125e5fd3d252b3a8e78d85e31ae;hpb=61775197c9b912a213e28ca56d1d9b3280096ab6;p=cln.git diff --git a/include/cln/object.h b/include/cln/object.h index 3f5db3c..61a614e 100644 --- a/include/cln/object.h +++ b/include/cln/object.h @@ -13,25 +13,8 @@ namespace cln { // is sufficient. Is also has the advantage of being mostly non-interrupting. -// An object is either a pointer to heap allocated data -// or immediate data. - +// An object is either a pointer to heap allocated data or immediate data. // It is possible to distinguish these because pointers are aligned. -// cl_word_alignment is the guaranteed alignment of a `void*' or `long' -// in memory. Must be > 1. -#if defined(__m68k__) - #define cl_word_alignment 2 -#endif -#if defined(__i386__) || (defined(__mips__) && !defined(__LP64__)) || (defined(__sparc__) && !defined(__arch64__)) || defined(__hppa__) || defined(__arm__) || defined(__rs6000__) || defined(__m88k__) || defined(__convex__) || (defined(__s390__) && !defined(__s390x__)) || defined(__sh__) || (defined(__x86_64__) && defined(__ILP32__)) - #define cl_word_alignment 4 -#endif -#if defined(__alpha__) || defined(__ia64__) || defined(__mips64__) || defined(__powerpc64__) || (defined(__sparc__) && defined(__arch64__)) || (defined(__x86_64__) && !defined(__ILP32__)) || defined(__s390x__) || defined(__aarch64__) || (defined(__riscv) && __riscv_xlen == 64) || defined(__e2k__) - #define cl_word_alignment 8 -#endif -#if !defined(cl_word_alignment) - #error "Define cl_word_alignment for your CPU!" -#endif - // Four basic classes are introduced: // @@ -111,26 +94,27 @@ inline cl_uint cl_value (cl_uint word) } // Return a word, combining a value and a tag. -inline cl_uint cl_combine (cl_uint tag, cl_uint value) +inline cl_uint cl_combine_impl (cl_uint tag, cl_uint value) { return (value << cl_value_shift) + (tag << cl_tag_shift); } -inline cl_uint cl_combine (cl_uint tag, cl_sint value) +inline cl_uint cl_combine_impl (cl_uint tag, cl_sint value) { // This assumes cl_value_shift + cl_value_len == cl_pointer_size. return (value << cl_value_shift) + (tag << cl_tag_shift); } -// Keep the compiler happy. inline cl_uint cl_combine (cl_uint tag, unsigned int value) -{ return cl_combine(tag, (cl_uint)value); } +{ return cl_combine_impl(tag, (cl_uint)value); } inline cl_uint cl_combine (cl_uint tag, int value) -{ return cl_combine(tag, (cl_sint)value); } -#ifdef HAVE_LONGLONG +{ return cl_combine_impl(tag, (cl_sint)value); } +inline cl_uint cl_combine (cl_uint tag, unsigned long value) +{ return cl_combine_impl(tag, (cl_uint)value); } +inline cl_uint cl_combine (cl_uint tag, long value) +{ return cl_combine_impl(tag, (cl_sint)value); } inline cl_uint cl_combine (cl_uint tag, unsigned long long value) -{ return cl_combine(tag, (cl_uint)value); } +{ return cl_combine_impl(tag, (cl_uint)value); } inline cl_uint cl_combine (cl_uint tag, long long value) -{ return cl_combine(tag, (cl_uint)value); } -#endif +{ return cl_combine_impl(tag, (cl_uint)value); } // Definition of the tags. #if !defined(CL_WIDE_POINTERS)