Bitwise & doesn't work with large numbers

Just starting out? Need help? Post your questions and find answers here.
User avatar
Peter
Posts: 1197
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Bitwise & doesn't work with large numbers

Post by Peter »

please see the code below and see the output-differences between SpiderBasic and PureBasic:

Code: Select all

EnumerationBinary ; EventTypes
  #w2ui_EventType_OnAdd              ; Called when user clicks the Add New button on the toolbar. 
  #w2ui_EventType_OnChange           ; Called when user changes any field in the editable row. 
  #w2ui_EventType_OnClick            ; Called when user clicks a record. 
  #w2ui_EventType_OnCollapse         ; Called when user collapses epxandable record. 
  #w2ui_EventType_OnColumnClick      ; Called when user clicks a column. 
  #w2ui_EventType_OnColumnOnOff      ; Called when user shows or hides a column selecting it in the grid settings menu. 
  #w2ui_EventType_OnColumnResize     ; Called when user resizes a column. 
  #w2ui_EventType_OnContextMenu      ; Called when user clicks right mouse button. 
  #w2ui_EventType_OnCopy             ; Called when user copies selected records to clipboard (ctrl+c or cmd+c). 
  #w2ui_EventType_OnDblClick         ; Called when user double clicks a record. 
  #w2ui_EventType_OnDelete           ; Called when user clicks the Delete button on the toolbar. 
  #w2ui_EventType_OnDeleted          ; Called when server responds back after delete request. 
  #w2ui_EventType_OnDestroy          ; Called when object is destroyed. 
  #w2ui_EventType_OnEdit             ; Called when user clicks the Edit button on the toolbar. 
  #w2ui_EventType_OnEditField        ; Called when user enters into editable mode for the field. 
  #w2ui_EventType_OnError            ; Called when server returns an error. 
  #w2ui_EventType_OnExpand           ; Called when user expands expandable record. 
  #w2ui_EventType_OnKeydown          ; Called when user presess a keyboard key and grid is active. 
  #w2ui_EventType_OnLoad             ; Called when server responds to a get-records request. 
  #w2ui_EventType_OnMenuClick        ; Called when user selects an item from the context menu. 
  #w2ui_EventType_OnPaste            ; Called when user pastes from clipboard (ctrl+v or cmd+v). 
  #w2ui_EventType_OnRefresh          ; Called when object is refreshed. 
  #w2ui_EventType_OnReload           ; Called when user clicks Reload button on the toolbar. 
  #w2ui_EventType_OnRender           ; Called when object is rendered. 
  #w2ui_EventType_OnRequest          ; Called on any server request. 
  #w2ui_EventType_OnResize           ; Called when object is resized.
  #w2ui_EventType_OnRestore          ; Called when user changes an editable records but it restores to its original value. 
  #w2ui_EventType_OnSave             ; Called when server responds back after save request. 
  #w2ui_EventType_OnSearch           ; Called when user applies a search. 
  #w2ui_EventType_OnSelect           ; Called when user selects a record. 
  #w2ui_EventType_OnSelectionExtend  ; Called when user extends selection by draggind small dot at the bottom right cornder of selection. 
  #w2ui_EventType_OnSort             ; Called when user applies a sort. 
  #w2ui_EventType_OnStateRestore     ; Called when user selects "Restore Default State". 
  #w2ui_EventType_OnStateSave        ; Called when user selects "Save Grid State". 
  #w2ui_EventType_OnSubmit           ; Called on user changed data is saved. 
  #w2ui_EventType_OnToolbar          ; Called when user clicks any button on the toolbar. 
  #w2ui_EventType_OnUnselect         ; Called when user unselects a record.
EndEnumeration

EventType.q = #w2ui_EventType_OnAdd |
              #w2ui_EventType_OnChange |
              #w2ui_EventType_OnClick |
              #w2ui_EventType_OnCollapse |
              #w2ui_EventType_OnColumnClick |
              #w2ui_EventType_OnColumnOnOff |
              #w2ui_EventType_OnColumnResize |
              #w2ui_EventType_OnContextMenu |
              #w2ui_EventType_OnCopy |
              #w2ui_EventType_OnDblClick |
              #w2ui_EventType_OnDelete |
              #w2ui_EventType_OnDeleted |
              #w2ui_EventType_OnDestroy |
              #w2ui_EventType_OnEdit |
              #w2ui_EventType_OnEditField |
              #w2ui_EventType_OnError |
              #w2ui_EventType_OnExpand |
              #w2ui_EventType_OnKeydown |
              #w2ui_EventType_OnLoad |
              #w2ui_EventType_OnMenuClick |
              #w2ui_EventType_OnPaste |
              #w2ui_EventType_OnRefresh |
              #w2ui_EventType_OnReload |
              #w2ui_EventType_OnRender |
              #w2ui_EventType_OnRequest |
              #w2ui_EventType_OnResize |
              #w2ui_EventType_OnRestore |
              #w2ui_EventType_OnSave |
              #w2ui_EventType_OnSearch |
              #w2ui_EventType_OnSelect |
              #w2ui_EventType_OnSelectionExtend |
              #w2ui_EventType_OnSort |
              #w2ui_EventType_OnStateRestore |
              #w2ui_EventType_OnStateSave |
              #w2ui_EventType_OnSubmit |
              #w2ui_EventType_OnToolbar |
              #w2ui_EventType_OnUnselect  

Debug EventType & #w2ui_EventType_OnAdd
Debug EventType & #w2ui_EventType_OnChange
Debug EventType & #w2ui_EventType_OnClick
Debug EventType & #w2ui_EventType_OnCollapse
Debug EventType & #w2ui_EventType_OnColumnClick
Debug EventType & #w2ui_EventType_OnColumnOnOff
Debug EventType & #w2ui_EventType_OnColumnResize
Debug EventType & #w2ui_EventType_OnContextMenu
Debug EventType & #w2ui_EventType_OnCopy
Debug EventType & #w2ui_EventType_OnDblClick
Debug EventType & #w2ui_EventType_OnDelete
Debug EventType & #w2ui_EventType_OnDeleted
Debug EventType & #w2ui_EventType_OnDestroy
Debug EventType & #w2ui_EventType_OnEdit
Debug EventType & #w2ui_EventType_OnEditField
Debug EventType & #w2ui_EventType_OnError
Debug EventType & #w2ui_EventType_OnExpand
Debug EventType & #w2ui_EventType_OnKeydown
Debug EventType & #w2ui_EventType_OnLoad
Debug EventType & #w2ui_EventType_OnMenuClick
Debug EventType & #w2ui_EventType_OnPaste
Debug EventType & #w2ui_EventType_OnRefresh
Debug EventType & #w2ui_EventType_OnReload
Debug EventType & #w2ui_EventType_OnRender
Debug EventType & #w2ui_EventType_OnRequest
Debug EventType & #w2ui_EventType_OnResize
Debug EventType & #w2ui_EventType_OnRestore
Debug EventType & #w2ui_EventType_OnSave
Debug EventType & #w2ui_EventType_OnSearch
Debug EventType & #w2ui_EventType_OnSelect
Debug EventType & #w2ui_EventType_OnSelectionExtend
Debug EventType & #w2ui_EventType_OnSort
Debug EventType & #w2ui_EventType_OnStateRestore
Debug EventType & #w2ui_EventType_OnStateSave
Debug EventType & #w2ui_EventType_OnSubmit
Debug EventType & #w2ui_EventType_OnToolbar
Debug EventType & #w2ui_EventType_OnUnselect
SpiderBasic-Debug wrote:1
2
4
8
16
32
64
128
256
512
1024
2048
4096
8192
16384
32768
65536
131072
262144
524288
1048576
2097152
4194304
8388608
16777216
33554432
67108864
134217728
268435456
536870912
1073741824
-2147483648
0
0
0
0
0
PureBasic-Debug wrote:1
2
4
8
16
32
64
128
256
512
1024
2048
4096
8192
16384
32768
65536
131072
262144
524288
1048576
2097152
4194304
8388608
16777216
33554432
67108864
134217728
268435456
536870912
1073741824
2147483648
4294967296
8589934592
17179869184
34359738368
68719476736
(i'm not shure if this is a bug because javascript has problems in handling large numbers)

Thanks in advance & Greetings ... Peter
Fred
Site Admin
Posts: 1821
Joined: Mon Feb 24, 2014 10:51 am

Re: Bitwise & doesn't work with large numbers

Post by Fred »

Yes, bitwise operation are only applied to 32-bit numbers, it should be noted somewhere (it's a JS thing)
Post Reply