Title: Buffer - feature request: Buffer.compare with offsets. · Issue #521 · nodejs/node · GitHub
Open Graph Title: Buffer - feature request: Buffer.compare with offsets. · Issue #521 · nodejs/node
X Title: Buffer - feature request: Buffer.compare with offsets. · Issue #521 · nodejs/node
Description: I'm really impressed with the new iojs features, an awesome work! Buffer.compare is a great iojs addition ( memcmp is very fast!), but, unfortunately, the current method implementation doesn't offer a way to compare 2 portions of Buffers...
Open Graph Description: I'm really impressed with the new iojs features, an awesome work! Buffer.compare is a great iojs addition ( memcmp is very fast!), but, unfortunately, the current method implementation doesn't offe...
X Description: I'm really impressed with the new iojs features, an awesome work! Buffer.compare is a great iojs addition ( memcmp is very fast!), but, unfortunately, the current method implementation doesn...
Opengraph URL: https://github.com/nodejs/node/issues/521
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Buffer - feature request: Buffer.compare with offsets.","articleBody":"I'm really impressed with the new **iojs** features, an awesome work!\n _[Buffer.compare](https://iojs.org/api/buffer.html#buffer_buf_compare_otherbuffer)_ is a great iojs addition ( _memcmp_ is very fast!), but, unfortunately, the current method [implementation](https://github.com/iojs/io.js/blob/v1.x/src/node_buffer.cc#L572) doesn't offer a way to compare 2 portions of Buffers: you are forced to slice one or both Buffers to compare desired portions of data.\n\nNow, Buffer.compare accepts 2 buffers as arguments, instead, it could accept 4 args (+1 optional), or something like that:\n\n``` javascript\nfunction ( Buffer b1, Number start1, Buffer b2, Number start2 [, Number length ] ) {}\n/*\n * For example, comparing 10 bytes:\n * - b1 from index 0 to 9 \n * - b2 from index 16 to 25\n */\nBuffer.compare( b1, 0, b2, 16, 10 )\n// or, to mantain current signature:\nBuffer.compare( b1, b2, 0, 16, 10 )\n```\n\n@trevnorris It would be great if it was planned to add this functionality, it simplify things a lot!!\n","author":{"url":"https://github.com/rootslab","@type":"Person","name":"rootslab"},"datePublished":"2015-01-20T03:45:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":15},"url":"https://github.com/521/node/issues/521"}
| 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:5ab9db4f-3a02-11f3-7750-6905174d8403 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D2BE:320E86:16D4A79:2119483:6A4E4FA9 |
| html-safe-nonce | 66b4f3517cb3c884371f10a6c73e5b891a2a4b653b50d0827acdefdff54f1c95 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMkJFOjMyMEU4NjoxNkQ0QTc5OjIxMTk0ODM6NkE0RTRGQTkiLCJ2aXNpdG9yX2lkIjoiNzk5NjMwNjQ3NDk0NTg5MjI2NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 57303db054a1e5cae07024a8ec1222053455d29e98f954f54c061906f60f3ce0 |
| hovercard-subject-tag | issue:54840651 |
| 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/nodejs/node/521/issue_layout |
| twitter:image | https://opengraph.githubassets.com/79a9ff53a7b86100f3a3def198b9f686d42eda2ce34f50297cba86128e89cdae/nodejs/node/issues/521 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/79a9ff53a7b86100f3a3def198b9f686d42eda2ce34f50297cba86128e89cdae/nodejs/node/issues/521 |
| og:image:alt | I'm really impressed with the new iojs features, an awesome work! Buffer.compare is a great iojs addition ( memcmp is very fast!), but, unfortunately, the current method implementation doesn't offe... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rootslab |
| hostname | github.com |
| expected-hostname | github.com |
| None | 030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| 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 | f344f1eab54fc7dfc02d0d018cda7e158c3db65c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width