E eparent New Member Licensed User Longtime User Feb 21, 2013 #1 Is there a reason the Bit object was implemented to operate on Ints instead of Longs? Code: Copy Dim val As Long : val = 0x3082000000L Dim mask As Long : mask = 0x10F000F000L Dim result As Long : result = Bit.AND(val, mask) ' val = 208,339,468,288 ' mask = 72,746,070,016 ' result = -2,147,483,648 It seems if these operations have to be methods or functions instead of operators then they should accept the largest integer type. Thank you.
Is there a reason the Bit object was implemented to operate on Ints instead of Longs? Code: Copy Dim val As Long : val = 0x3082000000L Dim mask As Long : mask = 0x10F000F000L Dim result As Long : result = Bit.AND(val, mask) ' val = 208,339,468,288 ' mask = 72,746,070,016 ' result = -2,147,483,648 It seems if these operations have to be methods or functions instead of operators then they should accept the largest integer type. Thank you.
Erel B4X founder Staff member Licensed User Longtime User Feb 21, 2013 #2 There isn't a very good reason. For performance reasons it is better not to cast each int to long. It is possible to create a simple library that works with longs instead of ints. Upvote 0
There isn't a very good reason. For performance reasons it is better not to cast each int to long. It is possible to create a simple library that works with longs instead of ints.
E eparent New Member Licensed User Longtime User Feb 21, 2013 #3 Thank you. I will read through the tutorials for making a library. Upvote 0
M masky Member Licensed User Longtime User Dec 16, 2013 #4 Hello Eparent, Could you solve this issue? I'm in the same case right now. Thanks. Upvote 0