Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Implement] Buffer.concat #5

Open
wants to merge 10 commits into
base: master
from
Open

[Implement] Buffer.concat #5

wants to merge 10 commits into from

Conversation

@jtenner
Copy link
Collaborator

@jtenner jtenner commented Jul 18, 2019

Current problems:

  • No good logging for that extend ArrayBufferView (opened issue with as-pect jtenner/as-pect#132 )
  • No good way of comparing things that extend ArrayBufferView (opened issue with as-pect jtenner/as-pect#133 )
expect<Buffer>(actual).toStrictEqual(expected); // should compare lengths and values
  • No good way to create a buffer from scratch without a naive Buffer.from<T>() function
    • Could create a helper function, but that's a todo

This pull request is not blocked by anything. Current questions:

  • Should we set the length parameter to i32.MAX_VALUE?
  • Any suggestions for optimizations?
  • Should we do a null check on the array? (in case of uninitialized field problems?)
@jtenner jtenner requested a review from dcodeIO Jul 18, 2019
@jtenner jtenner self-assigned this Jul 18, 2019
assembly/buffer/index.ts Outdated Show resolved Hide resolved
assembly/buffer/index.ts Outdated Show resolved Hide resolved
assembly/buffer/index.ts Outdated Show resolved Hide resolved
@jtenner
Copy link
Collaborator Author

@jtenner jtenner commented Jul 19, 2019

I think I'm going to implement a test function for utility purposes.

function bufferFrom(values: i32[]): Buffer {
  let length = values.lengrh;
  let buffer = Buffer.allocUnsafe(length);
  for (let i = 0; i < length; i++) buffer[i] = u8(unchecked(values[i]));
  return buffer;
} 

This should be relatively safe for testing.

@jtenner jtenner closed this Jul 19, 2019
@jtenner jtenner reopened this Jul 19, 2019
@jtenner jtenner changed the title [Implement] Naive Buffer.concat<T> [Implement] Naive Buffer.concat Jul 19, 2019
@jtenner
Copy link
Collaborator Author

@jtenner jtenner commented Jul 31, 2019

Do you think this can be merged? It looks good to me.

@jtenner
Copy link
Collaborator Author

@jtenner jtenner commented Mar 12, 2020

Six months in the making! Time to revive this pull request.

jtenner added 5 commits Mar 12, 2020
@jtenner jtenner requested review from dcodeIO and MaxGraey Mar 12, 2020
@jtenner jtenner changed the title [Implement] Naive Buffer.concat [Implement] Buffer.concat Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.