Skip to content

Commit 87315a4

Browse files
committed
Better backport of R_isResizable()
1 parent c1c4f76 commit 87315a4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/data.table.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@
105105
# define R_duplicateAsResizable(x) R_duplicateAsResizable_(x)
106106
# define R_resizeVector(x, newlen) SETLENGTH(x, newlen)
107107
# define R_maxLength(x) TRUELENGTH(x)
108-
# define R_isResizable(x) ((bool)(IS_GROWABLE(x)))
108+
# define R_isResizable(x) R_isResizable_(x)
109+
static inline bool R_isResizable_(SEXP x) {
110+
// IS_GROWABLE also checks for TRUELENGTH < XLENGTH
111+
return (LEVELS(x) & 0x20) && TRUELENGTH(x);
112+
}
109113
#endif
110114

111115
// init.c

0 commit comments

Comments
 (0)