[LTP] [PATCH 1/4] tst_atomic: make tst_atomic_inc take a signed integer

Cyril Hrubis chrubis@suse.cz
Wed Apr 13 17:33:08 CEST 2016


Hi!
> > > This is a preparation for upcoming patches, which add atomic_add_return(),
> > > that takes signed integer.
> > 
> > What is the problem with unsigned integer?
> 
> All atomic code in kernel is int based. I wanted to match that as closely
> as possible in our code.

I on x86 that should not matter as addition for numbers in two's
complement is just the same for both signed and unsigned numbers and the
instruction just sets both carry and overflow flags and
programmer/compiler just uses one of them depending on if the number is
supposed to be signed or unsigned.

But I'm not expert on powerpc assembly nor s390 assembly and I certainly
do not want to become one :). So let's follow what kernel does here.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list