From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andrey Abramov <st5pub@yandex.ru>
Cc: peterz <peterz@infradead.org>, benh <benh@kernel.crashing.org>,
Dave Chinner <dchinner@redhat.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"yamada.masahiro" <yamada.masahiro@socionext.com>,
paulus <paulus@samba.org>, mpe <mpe@ellerman.id.au>,
hpa <hpa@zytor.com>, jslaby <jslaby@suse.cz>,
sfr <sfr@canb.auug.org.au>,
"darrick.wong" <darrick.wong@oracle.com>,
richard <richard@nod.at>, mark <mark@fasheh.com>,
x86 <x86@kernel.org>, mingo <mingo@redhat.com>,
"naveen.n.rao" <naveen.n.rao@linux.vnet.ibm.com>,
linux-snps-arc <linux-snps-arc@lists.infradead.org>,
jannh <jannh@google.com>, bp <bp@alien8.de>,
jlbec <jlbec@evilplan.org>, jpoimboe <jpoimboe@redhat.com>,
tglx <tglx@linutronix.de>, George Spelvin <lkml@sdf.org>,
dedekind1 <dedekind1@gmail.com>, vgupta <vgupta@synopsys.com>,
"ard.biesheuvel" <ard.biesheuvel@linaro.org>,
"adrian.hunter" <adrian.hunter@intel.com>,
gregkh <gregkh@linuxfoundation.org>,
linux-mtd <linux-mtd@lists.infradead.org>,
Morton Andrew <akpm@linux-foundation.org>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
ocfs2-devel <ocfs2-devel@oss.oracle.com>
Subject: Re: [PATCH v2 5/5] Lib: sort.h: replace int size with size_t size in the swap function
Date: Mon, 1 Apr 2019 12:35:55 +0300 [thread overview]
Message-ID: <20190401093555.GD9224@smile.fi.intel.com> (raw)
In-Reply-To: <23051461554058370@iva6-3ac3de5fcc31.qloud-c.yandex.net>
On Sun, Mar 31, 2019 at 09:52:50PM +0300, Andrey Abramov wrote:
> Replace int type with size_t type of the size argument
> in the swap function, also affect all its dependencies.
>
> It's always been weird that sort() takes a size_t element size,
> but passes an int size to (*swap)(). Not a bug because we don't
> sort objects >2GB large, but it's ugly.
Hmm... If (*swap)() is called recursively it means the change might increase
stack usage on 64-bit platforms.
Am I missing something?
>
> Signed-off-by: Andrey Abramov <st5pub@yandex.ru>
> Reviewed by: George Spelvin <lkml@sdf.org>
> ---
> arch/x86/kernel/unwind_orc.c | 2 +-
> include/linux/sort.h | 2 +-
> kernel/jump_label.c | 2 +-
> lib/extable.c | 2 +-
> lib/sort.c | 6 +++---
> 5 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
> index 89be1be1790c..1078c287198c 100644
> --- a/arch/x86/kernel/unwind_orc.c
> +++ b/arch/x86/kernel/unwind_orc.c
> @@ -176,7 +176,7 @@ static struct orc_entry *orc_find(unsigned long ip)
> return orc_ftrace_find(ip);
> }
>
> -static void orc_sort_swap(void *_a, void *_b, int size)
> +static void orc_sort_swap(void *_a, void *_b, size_t size)
> {
> struct orc_entry *orc_a, *orc_b;
> struct orc_entry orc_tmp;
> diff --git a/include/linux/sort.h b/include/linux/sort.h
> index 2b99a5dd073d..aea39d552ff7 100644
> --- a/include/linux/sort.h
> +++ b/include/linux/sort.h
> @@ -6,6 +6,6 @@
>
> void sort(void *base, size_t num, size_t size,
> int (*cmp)(const void *, const void *),
> - void (*swap)(void *, void *, int));
> + void (*swap)(void *, void *, size_t));
>
> #endif
> diff --git a/kernel/jump_label.c b/kernel/jump_label.c
> index bad96b476eb6..340b788571fb 100644
> --- a/kernel/jump_label.c
> +++ b/kernel/jump_label.c
> @@ -45,7 +45,7 @@ static int jump_label_cmp(const void *a, const void *b)
> return 0;
> }
>
> -static void jump_label_swap(void *a, void *b, int size)
> +static void jump_label_swap(void *a, void *b, size_t size)
> {
> long delta = (unsigned long)a - (unsigned long)b;
> struct jump_entry *jea = a;
> diff --git a/lib/extable.c b/lib/extable.c
> index f54996fdd0b8..db2888342cd7 100644
> --- a/lib/extable.c
> +++ b/lib/extable.c
> @@ -28,7 +28,7 @@ static inline unsigned long ex_to_insn(const struct exception_table_entry *x)
> #ifndef ARCH_HAS_RELATIVE_EXTABLE
> #define swap_ex NULL
> #else
> -static void swap_ex(void *a, void *b, int size)
> +static void swap_ex(void *a, void *b, size_t size)
> {
> struct exception_table_entry *x = a, *y = b, tmp;
> int delta = b - a;
> diff --git a/lib/sort.c b/lib/sort.c
> index 50855ea8c262..60fbbc29104a 100644
> --- a/lib/sort.c
> +++ b/lib/sort.c
> @@ -114,7 +114,7 @@ static void swap_bytes(void *a, void *b, size_t n)
> } while (n);
> }
>
> -typedef void (*swap_func_t)(void *a, void *b, int size);
> +typedef void (*swap_func_t)(void *a, void *b, size_t size);
>
> /*
> * The values are arbitrary as long as they can't be confused with
> @@ -138,7 +138,7 @@ static void do_swap(void *a, void *b, size_t size, swap_func_t swap_func)
> else if (swap_func == SWAP_BYTES)
> swap_bytes(a, b, size);
> else
> - swap_func(a, b, (int)size);
> + swap_func(a, b, size);
> }
>
> /**
> @@ -187,7 +187,7 @@ static size_t parent(size_t i, unsigned int lsbit, size_t size)
> */
> void sort(void *base, size_t num, size_t size,
> int (*cmp_func)(const void *, const void *),
> - void (*swap_func)(void *, void *, int size))
> + void (*swap_func)(void *, void *, size_t size))
> {
> /* pre-scale counters for performance */
> size_t n = num * size, a = (num/2) * size;
> --
> 2.21.0
>
>
--
With Best Regards,
Andy Shevchenko
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
WARNING: multiple messages have this Message-ID (diff)
From: andriy.shevchenko@linux.intel.com (Andy Shevchenko)
To: linux-snps-arc@lists.infradead.org
Subject: [PATCH v2 5/5] Lib: sort.h: replace int size with size_t size in the swap function
Date: Mon, 1 Apr 2019 12:35:55 +0300 [thread overview]
Message-ID: <20190401093555.GD9224@smile.fi.intel.com> (raw)
In-Reply-To: <23051461554058370@iva6-3ac3de5fcc31.qloud-c.yandex.net>
On Sun, Mar 31, 2019@09:52:50PM +0300, Andrey Abramov wrote:
> Replace int type with size_t type of the size argument
> in the swap function, also affect all its dependencies.
>
> It's always been weird that sort() takes a size_t element size,
> but passes an int size to (*swap)(). Not a bug because we don't
> sort objects >2GB large, but it's ugly.
Hmm... If (*swap)() is called recursively it means the change might increase
stack usage on 64-bit platforms.
Am I missing something?
>
> Signed-off-by: Andrey Abramov <st5pub at yandex.ru>
> Reviewed by: George Spelvin <lkml at sdf.org>
> ---
> arch/x86/kernel/unwind_orc.c | 2 +-
> include/linux/sort.h | 2 +-
> kernel/jump_label.c | 2 +-
> lib/extable.c | 2 +-
> lib/sort.c | 6 +++---
> 5 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
> index 89be1be1790c..1078c287198c 100644
> --- a/arch/x86/kernel/unwind_orc.c
> +++ b/arch/x86/kernel/unwind_orc.c
> @@ -176,7 +176,7 @@ static struct orc_entry *orc_find(unsigned long ip)
> return orc_ftrace_find(ip);
> }
>
> -static void orc_sort_swap(void *_a, void *_b, int size)
> +static void orc_sort_swap(void *_a, void *_b, size_t size)
> {
> struct orc_entry *orc_a, *orc_b;
> struct orc_entry orc_tmp;
> diff --git a/include/linux/sort.h b/include/linux/sort.h
> index 2b99a5dd073d..aea39d552ff7 100644
> --- a/include/linux/sort.h
> +++ b/include/linux/sort.h
> @@ -6,6 +6,6 @@
>
> void sort(void *base, size_t num, size_t size,
> int (*cmp)(const void *, const void *),
> - void (*swap)(void *, void *, int));
> + void (*swap)(void *, void *, size_t));
>
> #endif
> diff --git a/kernel/jump_label.c b/kernel/jump_label.c
> index bad96b476eb6..340b788571fb 100644
> --- a/kernel/jump_label.c
> +++ b/kernel/jump_label.c
> @@ -45,7 +45,7 @@ static int jump_label_cmp(const void *a, const void *b)
> return 0;
> }
>
> -static void jump_label_swap(void *a, void *b, int size)
> +static void jump_label_swap(void *a, void *b, size_t size)
> {
> long delta = (unsigned long)a - (unsigned long)b;
> struct jump_entry *jea = a;
> diff --git a/lib/extable.c b/lib/extable.c
> index f54996fdd0b8..db2888342cd7 100644
> --- a/lib/extable.c
> +++ b/lib/extable.c
> @@ -28,7 +28,7 @@ static inline unsigned long ex_to_insn(const struct exception_table_entry *x)
> #ifndef ARCH_HAS_RELATIVE_EXTABLE
> #define swap_ex NULL
> #else
> -static void swap_ex(void *a, void *b, int size)
> +static void swap_ex(void *a, void *b, size_t size)
> {
> struct exception_table_entry *x = a, *y = b, tmp;
> int delta = b - a;
> diff --git a/lib/sort.c b/lib/sort.c
> index 50855ea8c262..60fbbc29104a 100644
> --- a/lib/sort.c
> +++ b/lib/sort.c
> @@ -114,7 +114,7 @@ static void swap_bytes(void *a, void *b, size_t n)
> } while (n);
> }
>
> -typedef void (*swap_func_t)(void *a, void *b, int size);
> +typedef void (*swap_func_t)(void *a, void *b, size_t size);
>
> /*
> * The values are arbitrary as long as they can't be confused with
> @@ -138,7 +138,7 @@ static void do_swap(void *a, void *b, size_t size, swap_func_t swap_func)
> else if (swap_func == SWAP_BYTES)
> swap_bytes(a, b, size);
> else
> - swap_func(a, b, (int)size);
> + swap_func(a, b, size);
> }
>
> /**
> @@ -187,7 +187,7 @@ static size_t parent(size_t i, unsigned int lsbit, size_t size)
> */
> void sort(void *base, size_t num, size_t size,
> int (*cmp_func)(const void *, const void *),
> - void (*swap_func)(void *, void *, int size))
> + void (*swap_func)(void *, void *, size_t size))
> {
> /* pre-scale counters for performance */
> size_t n = num * size, a = (num/2) * size;
> --
> 2.21.0
>
>
--
With Best Regards,
Andy Shevchenko
WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andrey Abramov <st5pub@yandex.ru>
Cc: peterz <peterz@infradead.org>, Dave Chinner <dchinner@redhat.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"yamada.masahiro" <yamada.masahiro@socionext.com>,
paulus <paulus@samba.org>, hpa <hpa@zytor.com>,
jslaby <jslaby@suse.cz>, sfr <sfr@canb.auug.org.au>,
"darrick.wong" <darrick.wong@oracle.com>,
richard <richard@nod.at>, mark <mark@fasheh.com>,
x86 <x86@kernel.org>, mingo <mingo@redhat.com>,
"naveen.n.rao" <naveen.n.rao@linux.vnet.ibm.com>,
linux-snps-arc <linux-snps-arc@lists.infradead.org>,
jannh <jannh@google.com>, bp <bp@alien8.de>,
jlbec <jlbec@evilplan.org>, jpoimboe <jpoimboe@redhat.com>,
tglx <tglx@linutronix.de>, George Spelvin <lkml@sdf.org>,
dedekind1 <dedekind1@gmail.com>, vgupta <vgupta@synopsys.com>,
"ard.biesheuvel" <ard.biesheuvel@linaro.org>,
"adrian.hunter" <adrian.hunter@intel.com>,
gregkh <gregkh@linuxfoundation.org>,
linux-mtd <linux-mtd@lists.infradead.org>,
Morton Andrew <akpm@linux-foundation.org>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
ocfs2-devel <ocfs2-devel@oss.oracle.com>
Subject: Re: [PATCH v2 5/5] Lib: sort.h: replace int size with size_t size in the swap function
Date: Mon, 1 Apr 2019 12:35:55 +0300 [thread overview]
Message-ID: <20190401093555.GD9224@smile.fi.intel.com> (raw)
In-Reply-To: <23051461554058370@iva6-3ac3de5fcc31.qloud-c.yandex.net>
On Sun, Mar 31, 2019 at 09:52:50PM +0300, Andrey Abramov wrote:
> Replace int type with size_t type of the size argument
> in the swap function, also affect all its dependencies.
>
> It's always been weird that sort() takes a size_t element size,
> but passes an int size to (*swap)(). Not a bug because we don't
> sort objects >2GB large, but it's ugly.
Hmm... If (*swap)() is called recursively it means the change might increase
stack usage on 64-bit platforms.
Am I missing something?
>
> Signed-off-by: Andrey Abramov <st5pub@yandex.ru>
> Reviewed by: George Spelvin <lkml@sdf.org>
> ---
> arch/x86/kernel/unwind_orc.c | 2 +-
> include/linux/sort.h | 2 +-
> kernel/jump_label.c | 2 +-
> lib/extable.c | 2 +-
> lib/sort.c | 6 +++---
> 5 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
> index 89be1be1790c..1078c287198c 100644
> --- a/arch/x86/kernel/unwind_orc.c
> +++ b/arch/x86/kernel/unwind_orc.c
> @@ -176,7 +176,7 @@ static struct orc_entry *orc_find(unsigned long ip)
> return orc_ftrace_find(ip);
> }
>
> -static void orc_sort_swap(void *_a, void *_b, int size)
> +static void orc_sort_swap(void *_a, void *_b, size_t size)
> {
> struct orc_entry *orc_a, *orc_b;
> struct orc_entry orc_tmp;
> diff --git a/include/linux/sort.h b/include/linux/sort.h
> index 2b99a5dd073d..aea39d552ff7 100644
> --- a/include/linux/sort.h
> +++ b/include/linux/sort.h
> @@ -6,6 +6,6 @@
>
> void sort(void *base, size_t num, size_t size,
> int (*cmp)(const void *, const void *),
> - void (*swap)(void *, void *, int));
> + void (*swap)(void *, void *, size_t));
>
> #endif
> diff --git a/kernel/jump_label.c b/kernel/jump_label.c
> index bad96b476eb6..340b788571fb 100644
> --- a/kernel/jump_label.c
> +++ b/kernel/jump_label.c
> @@ -45,7 +45,7 @@ static int jump_label_cmp(const void *a, const void *b)
> return 0;
> }
>
> -static void jump_label_swap(void *a, void *b, int size)
> +static void jump_label_swap(void *a, void *b, size_t size)
> {
> long delta = (unsigned long)a - (unsigned long)b;
> struct jump_entry *jea = a;
> diff --git a/lib/extable.c b/lib/extable.c
> index f54996fdd0b8..db2888342cd7 100644
> --- a/lib/extable.c
> +++ b/lib/extable.c
> @@ -28,7 +28,7 @@ static inline unsigned long ex_to_insn(const struct exception_table_entry *x)
> #ifndef ARCH_HAS_RELATIVE_EXTABLE
> #define swap_ex NULL
> #else
> -static void swap_ex(void *a, void *b, int size)
> +static void swap_ex(void *a, void *b, size_t size)
> {
> struct exception_table_entry *x = a, *y = b, tmp;
> int delta = b - a;
> diff --git a/lib/sort.c b/lib/sort.c
> index 50855ea8c262..60fbbc29104a 100644
> --- a/lib/sort.c
> +++ b/lib/sort.c
> @@ -114,7 +114,7 @@ static void swap_bytes(void *a, void *b, size_t n)
> } while (n);
> }
>
> -typedef void (*swap_func_t)(void *a, void *b, int size);
> +typedef void (*swap_func_t)(void *a, void *b, size_t size);
>
> /*
> * The values are arbitrary as long as they can't be confused with
> @@ -138,7 +138,7 @@ static void do_swap(void *a, void *b, size_t size, swap_func_t swap_func)
> else if (swap_func == SWAP_BYTES)
> swap_bytes(a, b, size);
> else
> - swap_func(a, b, (int)size);
> + swap_func(a, b, size);
> }
>
> /**
> @@ -187,7 +187,7 @@ static size_t parent(size_t i, unsigned int lsbit, size_t size)
> */
> void sort(void *base, size_t num, size_t size,
> int (*cmp_func)(const void *, const void *),
> - void (*swap_func)(void *, void *, int size))
> + void (*swap_func)(void *, void *, size_t size))
> {
> /* pre-scale counters for performance */
> size_t n = num * size, a = (num/2) * size;
> --
> 2.21.0
>
>
--
With Best Regards,
Andy Shevchenko
WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andrey Abramov <st5pub@yandex.ru>
Cc: vgupta <vgupta@synopsys.com>, benh <benh@kernel.crashing.org>,
paulus <paulus@samba.org>, mpe <mpe@ellerman.id.au>,
tglx <tglx@linutronix.de>, mingo <mingo@redhat.com>,
bp <bp@alien8.de>, hpa <hpa@zytor.com>, x86 <x86@kernel.org>,
mark <mark@fasheh.com>, jlbec <jlbec@evilplan.org>,
richard <richard@nod.at>, dedekind1 <dedekind1@gmail.com>,
"adrian.hunter" <adrian.hunter@intel.com>,
gregkh <gregkh@linuxfoundation.org>,
"naveen.n.rao" <naveen.n.rao@linux.vnet.ibm.com>,
jpoimboe <jpoimboe@redhat.com>,
Dave Chinner <dchinner@redhat.com>,
"darrick.wong" <darrick.wong@oracle.com>,
"ard.biesheuvel" <ard.biesheuvel@linaro.org>,
George Spelvin <lkml@sdf.org>,
linux-snps-arc <linux-snps-arc@lists.infradead.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
ocfs2-devel <ocfs2-devel@oss.oracle.com>,
linux-mtd <linux-mtd@lists.infradead.org>,
sfr <sfr@canb.auug.org.au>, jannh <jannh@google.com>,
jslaby <jslaby@suse.cz>, peterz <peterz@infradead.org>,
"yamada.masahiro" <yamada.masahiro@socionext.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Morton Andrew <akpm@linux-foundation.org>
Subject: Re: [PATCH v2 5/5] Lib: sort.h: replace int size with size_t size in the swap function
Date: Mon, 1 Apr 2019 12:35:55 +0300 [thread overview]
Message-ID: <20190401093555.GD9224@smile.fi.intel.com> (raw)
In-Reply-To: <23051461554058370@iva6-3ac3de5fcc31.qloud-c.yandex.net>
On Sun, Mar 31, 2019 at 09:52:50PM +0300, Andrey Abramov wrote:
> Replace int type with size_t type of the size argument
> in the swap function, also affect all its dependencies.
>
> It's always been weird that sort() takes a size_t element size,
> but passes an int size to (*swap)(). Not a bug because we don't
> sort objects >2GB large, but it's ugly.
Hmm... If (*swap)() is called recursively it means the change might increase
stack usage on 64-bit platforms.
Am I missing something?
>
> Signed-off-by: Andrey Abramov <st5pub@yandex.ru>
> Reviewed by: George Spelvin <lkml@sdf.org>
> ---
> arch/x86/kernel/unwind_orc.c | 2 +-
> include/linux/sort.h | 2 +-
> kernel/jump_label.c | 2 +-
> lib/extable.c | 2 +-
> lib/sort.c | 6 +++---
> 5 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
> index 89be1be1790c..1078c287198c 100644
> --- a/arch/x86/kernel/unwind_orc.c
> +++ b/arch/x86/kernel/unwind_orc.c
> @@ -176,7 +176,7 @@ static struct orc_entry *orc_find(unsigned long ip)
> return orc_ftrace_find(ip);
> }
>
> -static void orc_sort_swap(void *_a, void *_b, int size)
> +static void orc_sort_swap(void *_a, void *_b, size_t size)
> {
> struct orc_entry *orc_a, *orc_b;
> struct orc_entry orc_tmp;
> diff --git a/include/linux/sort.h b/include/linux/sort.h
> index 2b99a5dd073d..aea39d552ff7 100644
> --- a/include/linux/sort.h
> +++ b/include/linux/sort.h
> @@ -6,6 +6,6 @@
>
> void sort(void *base, size_t num, size_t size,
> int (*cmp)(const void *, const void *),
> - void (*swap)(void *, void *, int));
> + void (*swap)(void *, void *, size_t));
>
> #endif
> diff --git a/kernel/jump_label.c b/kernel/jump_label.c
> index bad96b476eb6..340b788571fb 100644
> --- a/kernel/jump_label.c
> +++ b/kernel/jump_label.c
> @@ -45,7 +45,7 @@ static int jump_label_cmp(const void *a, const void *b)
> return 0;
> }
>
> -static void jump_label_swap(void *a, void *b, int size)
> +static void jump_label_swap(void *a, void *b, size_t size)
> {
> long delta = (unsigned long)a - (unsigned long)b;
> struct jump_entry *jea = a;
> diff --git a/lib/extable.c b/lib/extable.c
> index f54996fdd0b8..db2888342cd7 100644
> --- a/lib/extable.c
> +++ b/lib/extable.c
> @@ -28,7 +28,7 @@ static inline unsigned long ex_to_insn(const struct exception_table_entry *x)
> #ifndef ARCH_HAS_RELATIVE_EXTABLE
> #define swap_ex NULL
> #else
> -static void swap_ex(void *a, void *b, int size)
> +static void swap_ex(void *a, void *b, size_t size)
> {
> struct exception_table_entry *x = a, *y = b, tmp;
> int delta = b - a;
> diff --git a/lib/sort.c b/lib/sort.c
> index 50855ea8c262..60fbbc29104a 100644
> --- a/lib/sort.c
> +++ b/lib/sort.c
> @@ -114,7 +114,7 @@ static void swap_bytes(void *a, void *b, size_t n)
> } while (n);
> }
>
> -typedef void (*swap_func_t)(void *a, void *b, int size);
> +typedef void (*swap_func_t)(void *a, void *b, size_t size);
>
> /*
> * The values are arbitrary as long as they can't be confused with
> @@ -138,7 +138,7 @@ static void do_swap(void *a, void *b, size_t size, swap_func_t swap_func)
> else if (swap_func == SWAP_BYTES)
> swap_bytes(a, b, size);
> else
> - swap_func(a, b, (int)size);
> + swap_func(a, b, size);
> }
>
> /**
> @@ -187,7 +187,7 @@ static size_t parent(size_t i, unsigned int lsbit, size_t size)
> */
> void sort(void *base, size_t num, size_t size,
> int (*cmp_func)(const void *, const void *),
> - void (*swap_func)(void *, void *, int size))
> + void (*swap_func)(void *, void *, size_t size))
> {
> /* pre-scale counters for performance */
> size_t n = num * size, a = (num/2) * size;
> --
> 2.21.0
>
>
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2019-04-01 9:36 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-31 18:28 [PATCH v2 0/5] simple sort swap function improvements Andrey Abramov
2019-03-31 18:28 ` Andrey Abramov
2019-03-31 18:28 ` Andrey Abramov
2019-03-31 18:31 ` [PATCH v2 1/5] arch/arc: unwind.c: replace swap function with built-in one Andrey Abramov
2019-03-31 18:31 ` Andrey Abramov
2019-03-31 18:31 ` Andrey Abramov
2019-04-01 17:53 ` Vineet Gupta
2019-04-01 17:53 ` Vineet Gupta
2019-04-01 17:53 ` Vineet Gupta
2019-03-31 18:35 ` [PATCH v2 2/5] powerpc: module_[32|64].c: " Andrey Abramov
2019-03-31 18:35 ` Andrey Abramov
2019-03-31 18:35 ` Andrey Abramov
2019-04-01 11:08 ` Michael Ellerman
2019-04-01 11:08 ` Michael Ellerman
2019-04-01 11:08 ` Michael Ellerman
2019-04-01 11:08 ` Michael Ellerman
2019-03-31 18:42 ` [PATCH v2 3/5] ocfs2: dir, refcounttree, xattr: replace swap functions " Andrey Abramov
2019-03-31 18:42 ` Andrey Abramov
2019-03-31 18:42 ` Andrey Abramov
2019-03-31 18:47 ` [PATCH v2 4/5] ubifs: find.c: replace swap function " Andrey Abramov
2019-03-31 18:47 ` Andrey Abramov
2019-03-31 18:47 ` Andrey Abramov
2019-03-31 18:52 ` [PATCH v2 5/5] Lib: sort.h: replace int size with size_t size in the swap function Andrey Abramov
2019-03-31 18:52 ` Andrey Abramov
2019-03-31 18:52 ` Andrey Abramov
2019-04-01 9:35 ` Andy Shevchenko [this message]
2019-04-01 9:35 ` Andy Shevchenko
2019-04-01 9:35 ` Andy Shevchenko
2019-04-01 9:35 ` Andy Shevchenko
2019-04-01 9:56 ` George Spelvin
2019-04-01 9:56 ` George Spelvin
2019-04-01 9:56 ` George Spelvin
2019-04-01 9:56 ` George Spelvin
2019-04-01 10:28 ` Andy Shevchenko
2019-04-01 10:28 ` Andy Shevchenko
2019-04-01 10:28 ` Andy Shevchenko
2019-04-01 10:28 ` Andy Shevchenko
2019-04-01 9:25 ` [PATCH v2 0/5] simple sort swap function improvements Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190401093555.GD9224@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=adrian.hunter@intel.com \
--cc=akpm@linux-foundation.org \
--cc=ard.biesheuvel@linaro.org \
--cc=benh@kernel.crashing.org \
--cc=bp@alien8.de \
--cc=darrick.wong@oracle.com \
--cc=dchinner@redhat.com \
--cc=dedekind1@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=jannh@google.com \
--cc=jlbec@evilplan.org \
--cc=jpoimboe@redhat.com \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-snps-arc@lists.infradead.org \
--cc=linux@rasmusvillemoes.dk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lkml@sdf.org \
--cc=mark@fasheh.com \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=naveen.n.rao@linux.vnet.ibm.com \
--cc=ocfs2-devel@oss.oracle.com \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=richard@nod.at \
--cc=sfr@canb.auug.org.au \
--cc=st5pub@yandex.ru \
--cc=tglx@linutronix.de \
--cc=vgupta@synopsys.com \
--cc=x86@kernel.org \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.