mirror of
https://git.freebsd.org/ports.git
synced 2025-04-28 01:26:39 -04:00
- In ruler show the current line number as a percentage of the total lines - Link macro for hyperlink - Add showfilename set option - Fix undefined string comparison - Replace Clang-only __builtin_is_aligned with C code - Use memmove to realign buffers
21 lines
579 B
C
21 lines
579 B
C
--- common/mem.h.orig 2023-09-25 08:47:42 UTC
|
|
+++ common/mem.h
|
|
@@ -212,6 +212,18 @@ p2roundup(size_t n)
|
|
return (n);
|
|
}
|
|
|
|
+/*
|
|
+ * is_aligned --
|
|
+ * Determine whether the program can safely read an object with an
|
|
+ * alignment requirement from ptr.
|
|
+ *
|
|
+ * See also: https://clang.llvm.org/docs/LanguageExtensions.html#alignment-builtins
|
|
+ */
|
|
+static __inline int
|
|
+is_aligned(void *ptr, size_t alignment) {
|
|
+ return ((uintptr_t)ptr % alignment) == 0;
|
|
+}
|
|
+
|
|
/* Additional TAILQ helper. */
|
|
#define TAILQ_ENTRY_ISVALID(elm, field) \
|
|
((elm)->field.tqe_prev != NULL)
|