OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 if (minus) { | 611 if (minus) { |
612 neg(); | 612 neg(); |
613 muladd(1, 1); | 613 muladd(1, 1); |
614 } | 614 } |
615 | 615 |
616 return String.fromCharCode.apply(null, resultBytes); | 616 return String.fromCharCode.apply(null, resultBytes); |
617 }; | 617 }; |
618 | 618 |
619 | 619 |
620 /** | 620 /** |
| 621 * Converts a signed or unsigned decimal string into two 32-bit halves, and |
| 622 * stores them in the temp variables listed above. |
| 623 * @param {string} value The decimal string to convert. |
| 624 */ |
| 625 jspb.utils.splitDecimalString = function(value) { |
| 626 jspb.utils.splitHash64(jspb.utils.decimalStringToHash64(value)); |
| 627 }; |
| 628 |
| 629 |
| 630 /** |
621 * Converts an 8-character hash string into its hexadecimal representation. | 631 * Converts an 8-character hash string into its hexadecimal representation. |
622 * @param {string} hash | 632 * @param {string} hash |
623 * @return {string} | 633 * @return {string} |
624 */ | 634 */ |
625 jspb.utils.hash64ToHexString = function(hash) { | 635 jspb.utils.hash64ToHexString = function(hash) { |
626 var temp = new Array(18); | 636 var temp = new Array(18); |
627 temp[0] = '0'; | 637 temp[0] = '0'; |
628 temp[1] = 'x'; | 638 temp[1] = 'x'; |
629 | 639 |
630 for (var i = 0; i < 8; i++) { | 640 for (var i = 0; i < 8; i++) { |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 } | 976 } |
967 | 977 |
968 if (data.constructor === String) { | 978 if (data.constructor === String) { |
969 data = /** @type {string} */(data); | 979 data = /** @type {string} */(data); |
970 return goog.crypt.base64.decodeStringToUint8Array(data); | 980 return goog.crypt.base64.decodeStringToUint8Array(data); |
971 } | 981 } |
972 | 982 |
973 goog.asserts.fail('Type not convertible to Uint8Array.'); | 983 goog.asserts.fail('Type not convertible to Uint8Array.'); |
974 return /** @type {!Uint8Array} */(new Uint8Array(0)); | 984 return /** @type {!Uint8Array} */(new Uint8Array(0)); |
975 }; | 985 }; |
OLD | NEW |