Skip to content

Instantly share code, notes, and snippets.

@dherman
Created December 12, 2012 05:43
Show Gist options
  • Save dherman/4265135 to your computer and use it in GitHub Desktop.
Save dherman/4265135 to your computer and use it in GitHub Desktop.
struct view approach
var IPAddress = new StructType({
f0: uint8,
f1: uint8,
f2: uint8,
f3: uint8
});
var Packet = new StructType({ addr: IPAddress, ... });
var PacketArray = new ArrayType(Packet);
var lotsOfPackets = new PacketArray(LOTS);
for (let p of lotsOfPackets.cursor("addr")) {
...
}
+------------+ +----------------------+
| |---------->| |
| StructView | | StructView.prototype |
| |<----------| |
+------------+ +----------------------+
^
|
|
+---------------------+
| |
| p |
| |
+---------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment