Re: [Vala] Int64 operations, I'm confused



Ooops, wrong cut & paste, I mean :

(...)
                int64 val1 = 96;
                int64 val2 = val1 / 8;
                stdout.printf ("val1: %lld, val2 : %lld\n", val1, val2);

                int val4 = 96;
                int val5 = val4 / 8;
                stdout.printf ("val4: %d, val5 : %d\n", val4, val5);

                int64 val6 = 96;
                int val7 = (int) (val6 / 8);
                stdout.printf ("val6: %lld, val7 : %d\n", val6, val7);
(...)

Results :
val1: 96, val2 : 0
val4: 96, val5 : 12
val6: 96, val7 : 0

I'm using valac under Windows, using MingW.



You've not hit an issue with using lld have you?

https://mail.gnome.org/archives/vala-list/2012-May/msg00032.html

Steven N. Oliver


On Tue, Jul 30, 2013 at 9:44 AM, <raum no-log org> wrote:

There is something I do not understand. I try to make a simple operation
and here is the result.
(...)
                int64 val1 = 96;
                int64 val2 = val1 / 8;
                stdout.printf ("val1: %lld, val2 : %d\n", val1, val2);

                int val4 = 96;
                int val5 = val4 / 8;
                stdout.printf ("val4: %lld, val5 : %d\n", val4, val5);

(..)

Results :
val1: 96, val2 : 0
val4: 96, val5 : 12

In fact I want to use file.query_info() which returns an int64 for size
(actually 96 bytes). And I need to divide size by 8.... result => 0

Any advice ? :)

Thanks
_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]