Skip to content

add SIMD parsers - #64

Open
JaapWijnen wants to merge 1 commit into
apple:mainfrom
JaapWijnen:simd-parsers
Open

JaapWijnen wants to merge 1 commit into
apple:mainfrom
JaapWijnen:simd-parsers

Conversation

@JaapWijnen

Copy link
Copy Markdown

Description

This PR adds a parser for SIMD types.

Detailed Design

Adds a parser for when Scalar == UInt8 that resets input if not enough bytes are left in the span. (Similar to InlineArray behaviour
Adds another more generic parser that allows passing a per element parser to the SIMD type that gets run N types depending on the SIMD's scalarCount

example:

try SIMD8<UInt8>(parsing: &span) // checks if 8 bytes are available in the span. Otherwise throws. 

try SIMD8<UInt16>(parsing: &span, parser: UInt16.init(parsingBigEndian:)) // Runs the UInt16 big endian parser 8 times. Only throws if that parser throws. 

Documentation Plan

Added source level docs similar to the InlineArray structure.

Test Plan

Runs similar tests to the InlineArray parsers in SIMDParsingTests.swift

Source Impact

Only adds new api.

Checklist

  • I've added at least one test that validates that my change is working, if appropriate
  • I've followed the code style of the rest of the project
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant