Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: pkg/analyzer/lib/src/summary/flat_buffers.dart

Issue 1792523002: Use specialized _FbUint8List and Uint8ListReader. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/flat_buffers_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/flat_buffers.dart
diff --git a/pkg/analyzer/lib/src/summary/flat_buffers.dart b/pkg/analyzer/lib/src/summary/flat_buffers.dart
index 0464127939e6d806f17a551f37f774db1d676f9e..410d9d4b836cb6659996a1f76b51512016fda25c 100644
--- a/pkg/analyzer/lib/src/summary/flat_buffers.dart
+++ b/pkg/analyzer/lib/src/summary/flat_buffers.dart
@@ -720,6 +720,21 @@ class Uint32Reader extends Reader<int> {
}
/**
+ * Reader of lists of unsigned 8-bit integer values.
+ *
+ * The returned unmodifiable lists lazily read values on access.
+ */
+class Uint8ListReader extends Reader<List<int>> {
+ const Uint8ListReader();
+
+ @override
+ int get size => 4;
+
+ @override
+ List<int> read(BufferPointer bp) => new _FbUint8List(bp.derefObject());
+}
+
+/**
* The reader of unsigned 8-bit integers.
*/
class Uint8Reader extends Reader<int> {
@@ -840,6 +855,18 @@ class _FbUint32List extends _FbList<int> {
}
/**
+ * List backed by 8-bit unsigned integers.
+ */
+class _FbUint8List extends _FbList<int> {
+ _FbUint8List(BufferPointer bp) : super(bp);
+
+ @override
+ int operator [](int i) {
+ return bp._getUint8(4 + i);
+ }
+}
+
+/**
* Class that describes the structure of a table.
*/
class _VTable {
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/flat_buffers_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698