Title: [Question] Unexpected results · Issue #17 · PMunch/binaryparse · GitHub
Open Graph Title: [Question] Unexpected results · Issue #17 · PMunch/binaryparse
X Title: [Question] Unexpected results · Issue #17 · PMunch/binaryparse
Description: I have the following in python: import struct a = 0x95006c08 print( a & 0x3FF ) # First: 10 bits --> 8 print( (a >> 10) & 0x1FFF ) # Second: 13 bits --> 27 And I am trying to do the equialent with binaryparse: import binaryparse import s...
Open Graph Description: I have the following in python: import struct a = 0x95006c08 print( a & 0x3FF ) # First: 10 bits --> 8 print( (a >> 10) & 0x1FFF ) # Second: 13 bits --> 27 And I am trying to do the equialent with ...
X Description: I have the following in python: import struct a = 0x95006c08 print( a & 0x3FF ) # First: 10 bits --> 8 print( (a >> 10) & 0x1FFF ) # Second: 13 bits --> 27 And I am trying to do...
Opengraph URL: https://github.com/PMunch/binaryparse/issues/17
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Question] Unexpected results","articleBody":"I have the following in python:\r\n```python\r\nimport struct\r\n\r\na = 0x95006c08 \r\nprint( a & 0x3FF ) # First: 10 bits --> 8\r\nprint( (a >> 10) & 0x1FFF ) # Second: 13 bits --> 27\r\n```\r\nAnd I am trying to do the equialent with `binaryparse`:\r\n```nim\r\nimport binaryparse\r\nimport streams\r\n\r\ncreateParser(p):\r\n 10: a\r\n 13: b \r\n\r\nvar \r\n a = 0x95006C08 \r\n s = newStringStream()\r\n\r\ns.write(a)\r\ns.setPosition(0)\r\n\r\nvar tmp = p.get(s)\r\necho tmp.a # --> 33 (instead of 8)\r\necho tmp.b # --> 2688 (instead of 27)\r\n```\r\nWhat am I doing wrong? I am looking to replicate python's results.\r\n\r\nBy the way, `binaryparse` is AWESOME. I love it.","author":{"url":"https://github.com/mantielero","@type":"Person","name":"mantielero"},"datePublished":"2021-03-24T17:11:13Z","url":"https://github.com/PMunch/binaryparse/issues/17"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:660daf45-a134-db8a-59f6-27fbbf443459 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EDD4:B6AD3:379F21:4BCD76:6B07D9B4 |
| html-safe-nonce | e95a67fcbb9ee5064c32d72cd7acad5343e898bdb4badf7f4f9db6eb4ffb36ae |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFREQ0OkI2QUQzOjM3OUYyMTo0QkNENzY6NkIwN0Q5QjQiLCJ2aXNpdG9yX2lkIjoiODQ0ODIxNzYwMzc4ODc1NzQyOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ae20c9f4dee99f695f4bfb94859958cc113fb5dcc3d8f7ef6232bc7316fc207b |
| hovercard-subject-tag | issue:839943463 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PMunch/binaryparse/17/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f4acdc6f34e39dcc013b4df2d85254bda7d9fb08db42b93db3750c4f5a3168f3/PMunch/binaryparse/issues/17 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f4acdc6f34e39dcc013b4df2d85254bda7d9fb08db42b93db3750c4f5a3168f3/PMunch/binaryparse/issues/17 |
| og:image:alt | I have the following in python: import struct a = 0x95006c08 print( a & 0x3FF ) # First: 10 bits --> 8 print( (a >> 10) & 0x1FFF ) # Second: 13 bits --> 27 And I am trying to do the equialent with ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mantielero |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0168e23a2b2810079baf03b0f12cd0e1e2092b544d3ac9fc0696e797ed643c |
| turbo-cache-control | no-preview |
| go-import | github.com/PMunch/binaryparse git https://github.com/PMunch/binaryparse.git |
| octolytics-dimension-user_id | 2845482 |
| octolytics-dimension-user_login | PMunch |
| octolytics-dimension-repository_id | 113347009 |
| octolytics-dimension-repository_nwo | PMunch/binaryparse |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 113347009 |
| octolytics-dimension-repository_network_root_nwo | PMunch/binaryparse |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b23e2273e07767111c5ecbe6358628e57161e5ee |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width