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

Unified Diff: pkg/barback/lib/src/utils.dart

Issue 18854007: Binary assets and more unit tests for Asset. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 7 years, 5 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
Index: pkg/barback/lib/src/utils.dart
diff --git a/pkg/barback/lib/src/utils.dart b/pkg/barback/lib/src/utils.dart
new file mode 100644
index 0000000000000000000000000000000000000000..2e7906ede9a9526f6381529b8a773384736b8353
--- /dev/null
+++ b/pkg/barback/lib/src/utils.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library barback.utils;
+
+/// Converts a number in the range [0-255] to a two digit hex string.
+///
+/// For example, given `255`, returns `ff`.
+String byteToHex(int byte) {
nweiz 2013/07/09 02:00:01 assert(byte >= 0 && byte < 256)
Bob Nystrom 2013/07/09 16:26:03 Done.
+ const DIGITS = "0123456789abcdef";
+ return DIGITS[(byte ~/ 16) % 16] + DIGITS[byte % 16];
+}

Powered by Google App Engine
This is Rietveld 408576698