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 /** | |
631 * Converts an 8-character hash string into its hexadecimal representation. | 621 * Converts an 8-character hash string into its hexadecimal representation. |
632 * @param {string} hash | 622 * @param {string} hash |
633 * @return {string} | 623 * @return {string} |
634 */ | 624 */ |
635 jspb.utils.hash64ToHexString = function(hash) { | 625 jspb.utils.hash64ToHexString = function(hash) { |
636 var temp = new Array(18); | 626 var temp = new Array(18); |
637 temp[0] = '0'; | 627 temp[0] = '0'; |
638 temp[1] = 'x'; | 628 temp[1] = 'x'; |
639 | 629 |
640 for (var i = 0; i < 8; i++) { | 630 for (var i = 0; i < 8; i++) { |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 } | 966 } |
977 | 967 |
978 if (data.constructor === String) { | 968 if (data.constructor === String) { |
979 data = /** @type {string} */(data); | 969 data = /** @type {string} */(data); |
980 return goog.crypt.base64.decodeStringToUint8Array(data); | 970 return goog.crypt.base64.decodeStringToUint8Array(data); |
981 } | 971 } |
982 | 972 |
983 goog.asserts.fail('Type not convertible to Uint8Array.'); | 973 goog.asserts.fail('Type not convertible to Uint8Array.'); |
984 return /** @type {!Uint8Array} */(new Uint8Array(0)); | 974 return /** @type {!Uint8Array} */(new Uint8Array(0)); |
985 }; | 975 }; |
OLD | NEW |