On 11/13/2013 02:27 PM, Martin Schreiber wrote:
> therefore "int64: 2;" is invalid, i

I don't agree that this is sensible, but it's up to you.

how would you define a bitpacked record filed with two bits that is 
intended to be handled as a signed integer ?

ty tr = ??????;

r : tr;
i: int32

r.x2 := -1;
i := 0;

i := i + r.x2

the result should be i = -1


(Additional issue:

when doing
i := r.x2 shl 10;

what should the result be ?

By definition (IMHO) any two-operand operation should be done using the 
smallest bit size bigger than the bit size of both operands (maybe up 
rounded to 8^n), The bit size of the variable to store the result in is 
ignored.

here
r.x2: bit size 2 rounded to 8
10: bit size 3 rounded to 8

shl done in 8 bit

result is 0 (Maybe the definition is "at least bigger than the bit size 
of both operands") and a correct result would be acceptable.

But if more bits than the "default integer size of the architecture" is 
involved, it is very common, that for speed sake operations are done 
with smaller bit sizes than expected on the first sight.


-Michael


------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to