Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Mar 2015 11:26:12 -0700
From:      hiren panchasara <hiren@strugglingcoder.info>
To:        "Simon J. Gerraty" <sjg@juniper.net>
Cc:        Anuranjan Shukla <anshukla@juniper.net>, "freebsd-arch@freebsd.org" <freebsd-arch@freebsd.org>
Subject:   Re: Buggy sbspace() on 64bit builds?
Message-ID:  <20150311182612.GL88380@strugglingcoder.info>
In-Reply-To: <5977.1423271024@chaos>
References:  <D0F95E21.2489D%anshukla@juniper.net> <20150206183036.S1246@besplex.bde.org> <D0FA7C7B.249B1%anshukla@juniper.net> <5977.1423271024@chaos>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On 02/06/15 at 05:03P, Simon J. Gerraty wrote:
> Anuranjan Shukla <anshukla@juniper.net> wrote:
> > this, along with return value being 'int' acceptable as a final
> > determination? 
> 
> It is ok for the function to return long, 
> so long as an int is used internally.
> Casting the int to long - implicit on return does no harm.
> 
> #include <stdio.h>
> #include <sys/types.h>
> #include <unistd.h>
> 
> int
> main(int argc, char *argv[])
> {
>     uint a, b;
>     long r1;
>     int r2;
> 
>     a = 1;
>     b = 2;
> 
>     r1 = a - b;
>     r2 = a - b;
> 
>     printf("r1=%ld\nr2=%d\nr3=%ld\n", r1, r2, (long)r2);
>     exit(0);
> }
> 
> r1=4294967295
> r2=-1
> r3=-1
> 
> so I think just using 'int' internally should work for now,
> perhaps with a comment saying the object size should match
> those being subtracted etc.

Hi Simon/Anu,

Has this been committed yet? I believe I am running into something
similar in our stable10 build. I am not certain though. In any case,
this should be committed/mfc'd.

Cheers,
Hiren

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (FreeBSD)

iQF8BAEBCgBmBQJVAIjEXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNEUyMEZBMUQ4Nzg4RjNGMTdFNjZGMDI4
QjkyNTBFMTU2M0VERkU1AAoJEIuSUOFWPt/l9tUH/3/4B5XRumcFM28t70LIb/27
lnNEU+Xy9ZDfTbZ2J/JNNGgwgJ9jk3rMS3G5vtfKgdSZcCsqxMsJtfiG3Z1Mu9Tn
+n/baWWG5JeZzArFHuzR9Svly1sJD/EAm3K+UL1dTWjgFMpgYnstHAeTeMqlW3jb
jhKh458zhztZMwQWOQGgUrEnhz9eYmObVF1rr48VFmVX3BE2oaw76SwwtBweE+Ti
E1UVxvlsQrSHV+QoutHCEx/f0bh1QnuBL7Ps6m8h4prrJrA073rXG+Rp9JTmACEr
Y5ionOdjPmrRWJqxnou1wCsn8WT1D7aHqszqOa17ifXZJK4mo+Syae04huu88Yw=
=dj1p
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150311182612.GL88380>