ruby-changes:63285
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Tue, 6 Oct 2020 14:20:30 +0900 (JST)
Subject: [ruby-changes:63285] 62ddbfe2b9 (master): rb_memory_view_is_contiguous: convert into an inline function
https://git.ruby-lang.org/ruby.git/commit/?id=62ddbfe2b9 From 62ddbfe2b9fcadf201d8378fbd4bd53bcd3f7df1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= <shyouhei@r...> Date: Tue, 6 Oct 2020 12:13:21 +0900 Subject: rb_memory_view_is_contiguous: convert into an inline function diff --git a/include/ruby/memory_view.h b/include/ruby/memory_view.h index 58db2a9..b88784815 100644 --- a/include/ruby/memory_view.h +++ b/include/ruby/memory_view.h @@ -118,10 +118,6 @@ RBIMPL_SYMBOL_EXPORT_BEGIN() https://github.com/ruby/ruby/blob/trunk/include/ruby/memory_view.h#L118 /* memory_view.c */ bool rb_memory_view_register(VALUE klass, const rb_memory_view_entry_t *entry); -#define rb_memory_view_is_contiguous(view) ( \ - rb_memory_view_is_row_major_contiguous(view) \ - || rb_memory_view_is_column_major_contiguous(view)) - bool rb_memory_view_is_row_major_contiguous(const rb_memory_view_t *view); bool rb_memory_view_is_column_major_contiguous(const rb_memory_view_t *view); void rb_memory_view_fill_contiguous_strides(const ssize_t ndim, const ssize_t item_size, const ssize_t *const shape, const bool row_major_p, ssize_t *const strides); @@ -138,4 +134,18 @@ int rb_memory_view_release(rb_memory_view_t* memory_view); https://github.com/ruby/ruby/blob/trunk/include/ruby/memory_view.h#L134 RBIMPL_SYMBOL_EXPORT_END() +static inline bool +rb_memory_view_is_contiguous(const rb_memory_view_t *view) +{ + if (rb_memory_view_is_row_major_contiguous(view)) { + return true; + } + else if (rb_memory_view_is_column_major_contiguous(view)) { + return true; + } + else { + return false; + } +} + #endif /* RUBY_BUFFER_H */ -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/