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: main
Choose a base branch
from
Open

[Implement] Buffer.concat #5

wants to merge 10 commits into from

Conversation

jtenner
Copy link
Contributor

@jtenner jtenner commented Jul 18, 2019

Current problems:

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 added the enhancement New feature or request label Jul 18, 2019
@jtenner jtenner requested a review from dcodeIO July 18, 2019 20:10
@jtenner jtenner self-assigned this Jul 18, 2019
@jtenner
Copy link
Contributor Author

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
Contributor Author

jtenner commented Jul 31, 2019

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

@jtenner
Copy link
Contributor Author

jtenner commented Mar 12, 2020

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

@jtenner jtenner requested review from dcodeIO and MaxGraey March 12, 2020 20:35
@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
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants