From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from smtp6-g21.free.fr ([2a01:e0c:1:1599::15]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1RaAIl-00048K-Be for barebox@lists.infradead.org; Mon, 12 Dec 2011 18:08:39 +0000 From: Robert Jarzmik Date: Mon, 12 Dec 2011 19:08:13 +0100 Message-Id: <1323713295-21458-2-git-send-email-robert.jarzmik@free.fr> In-Reply-To: <1323713295-21458-1-git-send-email-robert.jarzmik@free.fr> References: <1323713295-21458-1-git-send-email-robert.jarzmik@free.fr> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: barebox-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: =?UTF-8?q?=5BPATCH=201/3=5D=20lib=3A=20add=20BCH=20encoding/decoding?= To: barebox@lists.infradead.org QXMgZmxhc2ggbWVtb3JpZXMgbmVlZCBCQ0ggY29ycmVjdGluZyBjb2RlcywgYWRkIHRoZSBCQ0gK bGlicmFyeSwgdGFrZW4gZnJvbSB0aGUgbGludXgga2VybmVsLgoKU2lnbmVkLW9mZi1ieTogUm9i ZXJ0IEphcnptaWsgPHJvYmVydC5qYXJ6bWlrQGZyZWUuZnI+Ci0tLQogaW5jbHVkZS9saW51eC9i Y2guaCB8ICAgNzkgKysrCiBsaWIvS2NvbmZpZyAgICAgICAgIHwgICAgNCArCiBsaWIvTWFrZWZp bGUgICAgICAgIHwgICAgMSArCiBsaWIvYmNoLmMgICAgICAgICAgIHwgMTM2NiArKysrKysrKysr KysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysKIDQgZmlsZXMgY2hhbmdl ZCwgMTQ1MCBpbnNlcnRpb25zKCspLCAwIGRlbGV0aW9ucygtKQogY3JlYXRlIG1vZGUgMTAwNjQ0 IGluY2x1ZGUv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4+IEdGX00oYmNoKSk7 CisJfQorCXJldHVybiB2OworfQorCisvKgorICogc2hvcnRlciBhbmQgZmFzdGVyIG1vZHVsbyBm dW5jdGlvbiwgb25seSB3b3JrcyB3aGVuIHYgPCAyTi4KKyAqLworc3RhdGljIGlubGluZSBpbnQg bW9kX3Moc3RydWN0IGJjaF9jb250cm9sICpiY2gsIHVuc2lnbmVkIGludCB2KQoreworCWNvbnN0 IHVuc2lnbmVkIGludCBuID0gR0ZfTihiY2gpOworCXJldHVybiAodiA8IG4pID8gdiA6IHYtbjsK K30KKworc3RhdGljIGlubGluZSBpbnQgZGVnKHVuc2lnbmVkIGludCBwb2x5KQoreworCS8qIHBv bHlub21pYWwgZGVncmVlIGlzIHRoZSBtb3N0LXNpZ25pZmljYW50IGJpdCBpbmRleCAqLworCXJl dHVybiBmbHMocG9seSktMTsKK30KKworc3RhdGljIGlubGluZSBpbnQgcGFyaXR5KHVuc2lnbmVk IGludCB4KQoreworCS8qCisJICogcHVibGljIGRvbWFpbiBjb2RlIHNuaXBwZXQsIGxpZnRlZCBm cm9tCisJICogaHR0cDovL3d3dy1ncmFwaGljcy5zdGFuZm9yZC5lZHUvfnNlYW5kZXIvYml0aGFj a3MuaHRtbAorCSAqLworCXggXj0geCA+PiAxOworCXggXj0geCA+PiAyOworCXggPSAoeCAmIDB4 MTExMTExMTFVKSAqIDB4MTExMTExMTFVOworCXJldHVybiAoeCA+PiAyOCkgJiAxOworfQorCisv KiBHYWxvaXMgZmllbGQgYmFzaWMgb3BlcmF0aW9uczogbXVsdGlwbHksIGRpdmlkZSwgaW52ZXJz ZSwgZXRjLiAqLworCitzdGF0aWMgaW5saW5lIHVuc2lnbmVkIGludCBnZl9tdWwoc3RydWN0IGJj aF9jb250cm9sICpiY2gsIHVuc2lnbmVkIGludCBhLAorCQkJCSAgdW5zaWduZWQgaW50IGIpCit7 CisJcmV0dXJuIChhICYmIGIpID8gYmNoLT5hX3Bvd190YWJbbW9kX3MoYmNoLCBiY2gtP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hbmQgcmV0dXJuIHRo ZSBudW1iZXIgb2YgZm91bmQgc29sdXRpb25zCisgKi8KK3N0YXRpYyBpbnQgc29sdmVfbGluZWFy X3N5c3RlbShzdHJ1Y3QgYmNoX2NvbnRyb2wgKmJjaCwgdW5zaWduZWQgaW50ICpyb3dzLAorCQkJ ICAgICAgIHVuc2lnbmVkIGludCAqc29sLCBpbnQgbnNvbCkKK3sKKwljb25zdCBpbnQgbSA9IEdG X00oYmNoKTsKKwl1bnNpZ25lZCBpbnQgdG1wLCBtYXNrOworCWludCByZW0sIGMsIHIsIHAsIGss IHBhcmFtW21dOworCisJayA9IDA7CisJbWFzayA9IDEgPDwgbTsKKworCS8qIEdhdXNzaWFuIGVs aW1pbmF0aW9uICovCisJZm9yIChjID0gMDsgYyA8IG07IGMrKykgeworCQlyZW0gPSAwOworCQlw ID0gYy1rOworCQkvKiBmaW5kIHN1aXRhYmxlIHJvdyBmb3IgZWxpbWluYXRpb24gKi8KKwkJZm9y IChyID0gcDsgciA8IG07IHIrKykgeworCQkJaWYgKHJvd3Nbcl0gJiBtYXNrKSB7CisJCQkJaWYg KHIgIT0gcCkgeworCQkJCQl0bXAgPSByb3dzW3JdOworCQkJCQlyb3dzW3JdID0gcm93c1twXTsK KwkJCQkJcm93c1twXSA9IHRtcDsKKwkJCQl9CisJCQkJcmVtID0gcisxOworCQkJCWJyZWFrOwor CQkJfQorCQl9CisJCWlmIChyZW0pIHsKKwkJCS8qIHBlcmZvcm0gZWxpbWluYXRpb24gb24gcmVt YWluaW5nIHJvd3MgKi8KKwkJCXRtcCA9IHJvd3NbcF07CisJCQlmb3IgKHIgPSByZW07IHIgPCBt OyByKyspIHsKKwkJCQlpZiAocm93c1tyXSAmIG1hc2spCisJCQkJCXJvd3Nbcl0gXj0gdG1wOwor CQkJfQorCQl9IGVsc2UgeworCQkJLyogZWxpbWluYXRpb24gbm90IG5lZWRlZCwgc3RvcmUgZGVm ZWN0aXZlIHJvdyBpbmRleCAqLworCQkJcGFyYW1baysrXSA9IGM7CisJCX0KKwkJbWFzayA+Pj0g MTsKKwl9CisJLyogcmV3cml0ZSBzeXN0ZW0sIGluc2VydGluZyBmYWtlIHBhcmFtZXRlciByb3dz ICovCisJaWYgKGsgPiAwKSB7CisJCXAgPSBrOworCQlmb3IgKHIgPSBtLTE7IHIgPj0gMDsgci0t KSB7CisJCQlpZiAoKHIgPiBtLTEtaykgJiYgcm93c1tyXSkKKwkJCQkvKiBzeXN0ZW0gaGFzIG5v IHNvbHV0aW9uICovCisJCQkJcmV0dXJuIDA7CisKKwkJCXJvd3Nbcl0gPSAocCAmJiAociA9PSBw YXJhbVtwLTFdKSkgPworCQkJCXAtLSwgMXUgPDwgKG0tcikgOiByb3dzW3ItcF07CisJCX0KKwl9 CisKKwlpZiAobnNvbCAhPSAoMSA8PCBrKSkKKwkJLyogdW5leHBlY3RlZCBudW1iZXIgb2Ygc29s dXRpb25zICovCisJCXJldHVybiAwOworCisJZm9yIChwID0gMDsgcCA8IG5zb2w7IHArKykgewor CQkvKiBzZXQgcGFyYW1ldGVycyBmb3IgcC10aCBzb2x1dGlvbiAqLworCQlmb3IgKGMgPSAwOyBj IDwgazsgYysrKQorCQkJcm93c1twYXJhbVtjXV0gPSAocm93c1twYXJhbVtjXV0gJiB+MSl8KChw ID4+IGMpICYgMSk7CisKKwkJLyogY29tcHV0ZSB1bmlxdWUgc29sdXRpb24gKi8KKwkJdG1wID0g MDsKKwkJZm9yIChyID0gbS0xOyByID49IDA7IHItLSkgeworCQkJbWFzayA9IHJvd3Nbcl0gJiAo dG1wfDEpOworCQkJdG1wIHw9IHBhcml0eShtYXNrKSA8PCAobS1yKTsKKwkJfQorCQlzb2xbcF0g PSB0bXAgPj4gMTsKKwl9CisJcmV0dXJuIG5zb2w7Cit9CisKKy8qCisgKiB0aGlzIGZ1bmN0aW9u IGJ1aWxkcyBhbmQgc29sdmVzIGEgbGluZWFyIHN5c3RlbSBmb3IgZmluZGluZyByb290cyBvZiBh IGRlZ3JlZQorICogNCBhZmZpbmUgbW9uaWMgcG9seW5vbWlhbCBYXjQrYVheMitiWCtjIG92ZXIg R0YoMl5tKS4KKyAqLworc3RhdGljIGludCBmaW5kX2FmZmluZTRfcm9vdHMoc3RydWN0IGJjaF9j b250cm9sICpiY2gsIHVuc2lnbmVkIGludCBhLAorCQkJICAgICAgdW5zaWduZWQgaW50IGIsIHVu c2lnbmVkIGludCBjLAorCQkJICAgICAgdW5zaWduZWQgaW50ICpyb290cykKK3sKKwlpbnQgaSwg aiwgazsKKwljb25zdCBpbnQgbSA9IEdGX00oYmNoKTsKKwl1bnNpZ25lZCBpbnQgbWFzayA9IDB4 ZmYsIHQsIHJvd3NbMTZdID0gezAsfTsKKworCWogPSBhX2xvZyhiY2gsIGIpOworCWsgPSBhX2xv ZyhiY2gsIGEpOworCXJvd3NbMF0gPSBjOworCisJLyogYnVpZCBsaW5lYXIgc3lzdGVtIHRvIHNv bHZlIFheNCthWF4yK2JYK2MgPSAwICovCisJZm9yIChpID0gMDsgaSA8IG07IGkrKykgeworCQly b3dzW2krMV0gPSBiY2gtPmFfcG93X3RhYls0KmldXgorCQkJKGEgPyBiY2gtPmFfcG93X3RhYltt b2RfcyhiY2gsIGspXSA6IDApXgorCQkJKGIgPyBiY2gtPmFfcG93X3RhYlttb2RfcyhiY2gsIGop XSA6IDApOworCQlqKys7CisJCWsgKz0gMjsKKwl9CisJLyoKKwkgKiB0cmFuc3Bvc2UgMTZ4MTYg bWF0cml4IGJlZm9yZSBwYXNzaW5nIGl0IHRvIGxpbmVhciBzb2x2ZXIKKwkgKiB3YXJuaW5nOiB0 aGlzIGNvZGUgYXNzdW1lcyBtIDwgMTYKKwkgKi8KKwlmb3IgKGogPSA4OyBqICE9IDA7IGogPj49 IDEsIG1hc2sgXj0gKG1hc2sgPDwgaikpIHsKKwkJZm9yIChrID0gMDsgayA8IDE2OyBrID0gKGsr aisxKSAmIH5qKSB7CisJCQl0ID0gKChyb3dzW2tdID4+IGopXnJvd3Nbayt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M6CisJCWNudCA9IGZpbmRfcG9s eV9kZWczX3Jvb3RzKGJjaCwgcG9seSwgcm9vdHMpOworCQlicmVhazsKKwljYXNlIDQ6CisJCWNu dCA9IGZpbmRfcG9seV9kZWc0X3Jvb3RzKGJjaCwgcG9seSwgcm9vdHMpOworCQlicmVhazsKKwlk ZWZhdWx0OgorCQkvKiBmYWN0b3IgcG9seW5vbWlhbCB1c2luZyBCZXJsZWthbXAgVHJhY2UgQWxn b3JpdGhtIChCVEEpICovCisJCWNudCA9IDA7CisJCWlmIChwb2x5LT5kZWcgJiYgKGsgPD0gR0Zf TShiY2gpKSkgeworCQkJZmFjdG9yX3BvbHlub21pYWwoYmNoLCBrLCBwb2x5LCAmZjEsICZmMik7 CisJCQlpZiAoZjEpCisJCQkJY250ICs9IGZpbmRfcG9seV9yb290cyhiY2gsIGsrMSwgZjEsIHJv b3RzKTsKKwkJCWlmIChmMikKKwkJCQljbnQgKz0gZmluZF9wb2x5X3Jvb3RzKGJjaCwgaysxLCBm Miwgcm9vdHMrY250KTsKKwkJfQorCQlicmVhazsKKwl9CisJcmV0dXJuIGNudDsKK30KKworI2lm IGRlZmluZWQoVVNFX0NISUVOX1NFQVJDSCkKKy8qCisgKiBleGhhdXN0aXZlIHJvb3Qgc2VhcmNo IChDaGllbikgaW1wbGVtZW50YXRpb24gLSBub3QgdXNlZCwgaW5jbHVkZWQgb25seSBmb3IKKyAq IHJlZmVyZW5jZS9jb21wYXJpc29uIHRlc3RzCisgKi8KK3N0YXRpYyBpbnQgY2hpZW5fc2VhcmNo KHN0cnVjdCBiY2hfY29udHJvbCAqYmNoLCB1bnNpZ25lZCBpbnQgbGVuLAorCQkJc3RydWN0IGdm X3BvbHkgKnAsIHVuc2lnbmVkIGludCAqcm9vdHMpCit7CisJaW50IG07CisJdW5zaWduZWQgaW50 IGksIGosIHN5biwgc3luMCwgY291bnQgPSAwOworCWNvbnN0IHVuc2lnbmVkIGludCBrID0gOCps ZW4rYmNoLT5lY2NfYml0cz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J CWJyZWFrOworCQkJfQorCQkJeSBePSBhazsKKwkJfQorCX0KKwkvKiBzaG91bGQgbm90IGhhcHBl biBidXQgY2hlY2sgYW55d2F5ICovCisJcmV0dXJuIHJlbWFpbmluZyA/IC0xIDogMDsKK30KKwor c3RhdGljIHZvaWQgKmJjaF9hbGxvYyhzaXplX3Qgc2l6ZSwgaW50ICplcnIpCit7CisJdm9pZCAq cHRyOworCisJcHRyID0ga21hbGxvYyhzaXplLCBHRlBfS0VSTkVMKTsKKwlpZiAocHRyID09IE5V TEwpCisJCSplcnIgPSAxOworCXJldHVybiBwdHI7Cit9CisKKy8qCisgKiBjb21wdXRlIGdlbmVy YXRvciBwb2x5bm9taWFsIGZvciBnaXZlbiAobSx0KSBwYXJhbWV0ZXJzLgorICovCitzdGF0aWMg dWludDMyX3QgKmNvbXB1dGVfZ2VuZXJhdG9yX3BvbHlub21pYWwoc3RydWN0IGJjaF9jb250cm9s ICpiY2gpCit7CisJY29uc3QgdW5zaWduZWQgaW50IG0gPSBHRl9NKGJjaCk7CisJY29uc3QgdW5z aWduZWQgaW50IHQgPSBHRl9UKGJjaCk7CisJaW50IG4sIGVyciA9IDA7CisJdW5zaWduZWQgaW50 IGksIGosIG5iaXRzLCByLCB3b3JkLCAqcm9vdHM7CisJc3RydWN0IGdmX3BvbHkgKmc7CisJdWlu dDMyX3QgKmdlbnBvbHk7CisKKwlnID0gYmNoX2FsbG9jKEdGX1BPTFlfU1oobSp0KSwgJmVycik7 CisJcm9vdHMgPSBiY2hfYWxsb2MoKGJjaC0+bisxKSpzaXplb2YoKnJvb3RzKSwgJmVycik7CisJ Z2VucG9seSA9IGJjaF9hbGxvYyhESVZfUk9VTkRfVVAobSp0KzEsIDMyKSpzaXplb2YoKmdlbnBv bHkpLCAmZXJyKTsKKworCWlmIChlcnIpIHsKKwkJa2ZyZWUoZ2VucG9seSk7CisJCWdlbnBvbHkg PSBOVUxMOworCQlnb3RvIGZpbmlzaDsKKwl9CisKKwkvKiBlbn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