MCPcopy Create free account
hub / github.com/Moli-X/Resources / cb_btou

Function cb_btou

Script/Parser.js:3062–3084  ·  view source on GitHub ↗
(cccc)

Source from the content-addressed store, hash-verified

3060 // decoder stuff
3061 var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
3062 var cb_btou = function (cccc) {
3063 switch (cccc.length) {
3064 case 4:
3065 var cp = ((0x07 & cccc.charCodeAt(0)) << 18)
3066 | ((0x3f & cccc.charCodeAt(1)) << 12)
3067 | ((0x3f & cccc.charCodeAt(2)) << 6)
3068 | (0x3f & cccc.charCodeAt(3)),
3069 offset = cp - 0x10000;
3070 return (fromCharCode((offset >>> 10) + 0xD800)
3071 + fromCharCode((offset & 0x3FF) + 0xDC00));
3072 case 3:
3073 return fromCharCode(
3074 ((0x0f & cccc.charCodeAt(0)) << 12)
3075 | ((0x3f & cccc.charCodeAt(1)) << 6)
3076 | (0x3f & cccc.charCodeAt(2))
3077 );
3078 default:
3079 return fromCharCode(
3080 ((0x1f & cccc.charCodeAt(0)) << 6)
3081 | (0x3f & cccc.charCodeAt(1))
3082 );
3083 }
3084 };
3085 var btou = function (b) {
3086 return b.replace(re_btou, cb_btou);
3087 };

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected