| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 define(function() { | |
| 6 function hexify(value, length) { | |
| 7 var hex = value.toString(16); | |
| 8 while (hex.length < length) | |
| 9 hex = "0" + hex; | |
| 10 return hex; | |
| 11 } | |
| 12 | |
| 13 function dumpArray(bytes) { | |
| 14 var dumped = ""; | |
| 15 for (var i = 0; i < bytes.length; ++i) { | |
| 16 dumped += hexify(bytes[i], 2); | |
| 17 | |
| 18 if (i % 16 == 15) { | |
| 19 dumped += "\n"; | |
| 20 continue; | |
| 21 } | |
| 22 | |
| 23 if (i % 2 == 1) | |
| 24 dumped += " "; | |
| 25 if (i % 8 == 7) | |
| 26 dumped += " "; | |
| 27 } | |
| 28 return dumped; | |
| 29 } | |
| 30 | |
| 31 var exports = {}; | |
| 32 exports.dumpArray = dumpArray; | |
| 33 return exports; | |
| 34 }); | |
| OLD | NEW |