Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5034247imw; Tue, 19 Jul 2022 19:21:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vLnyfu1WohknW0u4zSnQGgFDFD6NyltvHBRe1cuNktWRMLr0qOZlrj/Ojhbs4fdFosyVBw X-Received: by 2002:a05:6a00:1393:b0:52a:d70a:bad with SMTP id t19-20020a056a00139300b0052ad70a0badmr36490091pfg.43.1658283692150; Tue, 19 Jul 2022 19:21:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658283692; cv=pass; d=google.com; s=arc-20160816; b=pmPz4Bgn2VRF4Y4KQr2aknU9gl1lp//nlgGTbyxrbPGjZ9KCEYRoc58/kXzGM2L75t A9vlqQ8CbeV7l+KH5/q3dB0MqQ08xLWxqI8O0Czo5xrXeGvOWckPxL87T3CUE+ffhucT bvcoeRDQWMTZeH6rW62MXFE39QM3QptHDLEvkFQvf5oDoe3X684976oAbH4eLgggHejb qqx+cVPZv35HvqqZocracFX+la5gjU9FXETlnh0V97XCGnzHG12t1FZdogeDTyIguZBk 92gUVmrK9ee9Fo+eAdSEJ/YpfMutEDqBf1tyirAsdFb1yGsCsZ37Nrb3gPRyTeoOxrw4 5j+g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature:dkim-signature; bh=jb5MEgryPVnZ/5su0mF7TMS/HVzzs+PR+9922kH4eBQ=; b=UcUhFJ/QodYLHkPTZgsDAAEtZXqH90Ccbhe36+cfrziLzQVIuSKGhYNIsxu6WjePTM kGu1Hs1UDjBx7iUS6HSXre5AG+qV+KUvun8Gjd6y3mxFPPwEdSGGcljThLcTj4rQI8kx +WTjPN9jEGfYAfWnmAkHROHIBE2S+tSk7M3kcETy2Nb9GmqYWytZeuWcdr+0gaOuJSIs 0W5tQJAnlTE/brKTKtjs8whG/73MkNIvEyM2bv6t0b/BFmsjuo5JthBANLv8NTZ88K7f Epv0nCTEveuXQ73OY0N0xcvq+G1pKrUCFNIx0rduevSWHucoTQpIs/R6xrptBb1d7akJ mK9w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=xU5jaI9P; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="P9VMLLQ/"; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z64-20020a636543000000b0041957b9d451si17347942pgb.595.2022.07.19.19.21.15; Tue, 19 Jul 2022 19:21:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=xU5jaI9P; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="P9VMLLQ/"; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232735AbiGTCTX (ORCPT + 99 others); Tue, 19 Jul 2022 22:19:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240361AbiGTCSH (ORCPT ); Tue, 19 Jul 2022 22:18:07 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9919599ED for ; Tue, 19 Jul 2022 19:18:01 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26K1FaEG015096; Wed, 20 Jul 2022 02:17:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-id : content-transfer-encoding : mime-version; s=corp-2022-7-12; bh=jb5MEgryPVnZ/5su0mF7TMS/HVzzs+PR+9922kH4eBQ=; b=xU5jaI9Pt8WsMaUj914AI/v+CAO8SFh73786qWKeC0SsL+bJbvRKPdN1EWF8uTDC3UOS vVokX0fp9zpD+YYb6cjLFDvMuO4O003PTDVyLCr3DnqSGb1+4PTD7OGSqTCesQaHN4lb w25rup/t66JSuzX/hgyXHKC5bedAkZfQ+JmWjq9S2GzZpNtvsBIHh94gPQrvs4iz+E7c g7XXU29Yv6uKJtl83LHdNRwG712FmAfbIUGtiVAeYakgtmo2H+nIkkfWqpHae/sRpy/u 0tau3SDTk5w9RghxaO3+iUutUHmsb4w0J/rzjNwhEKTzUhwobwIVBA8RYSgbCZ+U71Ik 9g== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3hbm42g53y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Jul 2022 02:17:48 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 26K0eeOi022175; Wed, 20 Jul 2022 02:17:47 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2044.outbound.protection.outlook.com [104.47.74.44]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3hc1hseana-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Jul 2022 02:17:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vbl/UgEB4iLqWTd9ZX6iS0Vq4i9x/J0qWx/pr7SYgpGMW9i9AupZruFFxl62nX5qAB7D4Z9btIpd5QIU/1AX1WnL0HpYcaMyay/ScNn4TceIbr5hgx51F61rwdkK024y8sOCqeBABjGENubE+ByThHQuZ0Xv0y3UG3taZBnM4bX6/7j0NiQM18Cww9ex3Yxo7JNu6aJmcrRj/W53c8jDDp+TaNtV/EMQdCm9st7gpkFsi9dWxxG+3Xj9Kfpe1sbmbwzq991YrVMOXk4MflQoYCHgKTqq05+NampTwFnPXFd/EiZsMvx197JXKiHHuluFe8Dr/tpVMwGtS71me/A8nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jb5MEgryPVnZ/5su0mF7TMS/HVzzs+PR+9922kH4eBQ=; b=QUExKJqN2OCCl6FJ/BMb2o/PMX4QwjSEJDDQV+EWrP17xpnV4deuXboF3r8yzKx/ptd8NNurbpNJmjHAUAcKs5UQAEo1J1lrCGURwf2jhrQw+L6F8CF31l/ynPpgI0AZ8WlG/GeuCNRobZyktXfNa/ANjL3oGe3dx6rRm9rA5NETJTFjdLZVth65ph/cpypA/QVLjaTNLX6vV7hcfqaFQ4CgEBvGcazL+idnQ2kCjorjTCRL/2k016M1/yHp8SEHSVtBwx1EDgBflMoUErRyjtYhrNcmGMKxZq6A1YRXwIdRBYCJjj1IUsu3wDVwyMcAKgBsG7/n7gNR3jgGAdPjHg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jb5MEgryPVnZ/5su0mF7TMS/HVzzs+PR+9922kH4eBQ=; b=P9VMLLQ/1/XGn1Fjs9UyWhzMworfE0Ux4iX1mZhMP/0uKfMZD/Ub943qWL+kv8cGNP+d9ie1K5z5HhKuSmdmmfPV2NW8mC7GF/b1WFvPTj4+1Zyhpf25qa99mAl4gSshc5RyTmEXs0k7+FCEJIbmRc1yAp414AUwqc6OH8tAlmg= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DM6PR10MB2889.namprd10.prod.outlook.com (2603:10b6:5:64::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.17; Wed, 20 Jul 2022 02:17:39 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::c4d1:edc3:7d21:7c68]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::c4d1:edc3:7d21:7c68%6]) with mapi id 15.20.5438.024; Wed, 20 Jul 2022 02:17:39 +0000 From: Liam Howlett To: "maple-tree@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton , Hugh Dickins CC: Yu Zhao Subject: [PATCH v12 01/69] Maple Tree: add new data structure Thread-Topic: [PATCH v12 01/69] Maple Tree: add new data structure Thread-Index: AQHYm97ikRRpyTcP5Um7xzA5qlGMyg== Date: Wed, 20 Jul 2022 02:17:39 +0000 Message-ID: <20220720021727.17018-2-Liam.Howlett@oracle.com> References: <20220720021727.17018-1-Liam.Howlett@oracle.com> In-Reply-To: <20220720021727.17018-1-Liam.Howlett@oracle.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.35.1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5c91633d-bc5a-443a-1eac-08da69f604fd x-ms-traffictypediagnostic: DM6PR10MB2889:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: LRxPrZbQjyn+QYMtJ4WTa7NRKx+TH2AVWeGMlDsrLLDQhaGRutJ2qMbvW6fqHYLHm1qfp0PqUvKYjVvBjjSnXLb3LSNKOfaG8QVMQ7Q6lgeaFC9v119s7wqK6wDo724LjKaHZuCHnZEEDzBAgJf38yU9nJSCWk4kMXRYnLXxXGsz/I40TqC9kKzAAgbm/nSryNAaKRU0sfoyPMvQ4+B4Wzlf+WuAmjex0WpIED/cGfuGH0MwXILOOLnObSqWD6RgSnKpsakw+MDDZMfd7fIzS8Ynuo2VMmutOdNvgFIL0/5UyOSz6q9bX5reQLtY//1NPnv3POAU0GIcgHoY76r22UiXPILBRANhxQTf881OX+k/85UTL1rmloxlgyz03pizXHGGg3Mwj1NHGwHQ6pFHFaEAmFSyvQXejN6MXkvrg7E1RX2c/D1It+z98oWSOPC50XTjKhXtWuicnK9XzJVfz29lrEhmz0S3AyItUBo6+u2PL47IYC+piSlkmoG5ApHw23oVxkZm00F5+ifOx8fuC3bCeH8odVTUunn9iZ4BIXTrkx7U1XTXCHNF5VPnEmA/RvV8BAdojQJl8u5FYZts7PwCrYAGPOZzikmveVAT9S5mnpFK8fbRCEnxV4tOXF0zUykaFAt6sJJEBDOq6CYCrKD62crDnJvodTNVXpZPiorXi+dHsLlNfofQD3QC6zRuA2vYt6Q+J4xBjo2Xe+i/Eplx0EGx2kdxK7ZSoNRIFEbPJ6MlwSxp5n8TF7ZQ5QHjHEEpnXvlnTKTFH0RKTqLNu4w3zmywff0Y5Cd8diRQWvEjAwlNnEGu5jWSLIxLdgLLMakIBkgDVDNYoQ37OM8gRgGV3jcN3GySdUc22WFUwBxPJo+0zfnnXiAg3U7/yddQdw0kFvGaAi7mvwNhQDC2w== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(136003)(346002)(376002)(396003)(366004)(39860400002)(8936002)(5660300002)(76116006)(44832011)(30864003)(64756008)(66476007)(66446008)(66946007)(66556008)(8676002)(4326008)(2906002)(91956017)(122000001)(38100700002)(86362001)(38070700005)(6486002)(966005)(36756003)(71200400001)(478600001)(41300700001)(83380400001)(316002)(110136005)(186003)(6512007)(26005)(6506007)(2616005)(1076003)(559001)(579004)(309714004);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?QkNhTDd3SkR5QXlaK2lpdVFKT2ttcWVtT2Y1UkEyRTdKaHBZQlpWKys1UW1k?= =?utf-8?B?QXoxbmJkckFJMlhXclkycFd5QU5vS2E0L0dNanZJYXVSajQvb2ZtSjJVN09L?= =?utf-8?B?Y0VWeXBiZytIbU53UXZuR0xrSkp4dGtBQU9NaTBmWnRTVHUzYUVQVmdKN0Mr?= =?utf-8?B?WEVuZmZ4S2taZFIvTFJxZi9vYlMwVWd1ck93Ny9RVEUwaXRFazlRMXY5WEpo?= =?utf-8?B?cnhnRmRpMFFpMUY2Q1NLODhuYkE2cE4zRE5laXlvSjQzcVVsdDZFeX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b1kvS3pDelpRbGE5SThyTUdtTGZBNC91MGU0L0RvZnM3MUY4TGZK?= =?utf-8?B?dGVtdU5zYWFRQ0RYNEJ5MFU4NHRNVXQ0ajBobDRZMVZBQjlrekhtVGMralpr?= =?utf-8?B?dGc9PQ==?= Content-Type: text/plain; charset="utf-8" Content-ID: <9C9ECA1A7410C649872892B0BD2ADF2D@namprd10.prod.outlook.com> Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c91633d-bc5a-443a-1eac-08da69f604fd X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2022 02:17:39.2602 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: wy92BAV3gLd6rLWkbbKftpIpbspI4/aqixA49DilSqBQm4GFxBz6ksrVkB1I/2FtQH9CAd52ual4o5YJR8ZjfQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB2889 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-19_10,2022-07-19_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 malwarescore=0 mlxscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207200008 X-Proofpoint-ORIG-GUID: 0sjywpP9hYkRrKJLVjrfEk9KMK8k2zJ1 X-Proofpoint-GUID: 0sjywpP9hYkRrKJLVjrfEk9KMK8k2zJ1 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org RnJvbTogIkxpYW0gUi4gSG93bGV0dCIgPExpYW0uSG93bGV0dEBPcmFjbGUuY29tPg0KDQpQYXRj aCBzZXJpZXMgIkludHJvZHVjaW5nIHRoZSBNYXBsZSBUcmVlIi4NCg0KVGhlIG1hcGxlIHRyZWUg aXMgYW4gUkNVLXNhZmUgcmFuZ2UgYmFzZWQgQi10cmVlIGRlc2lnbmVkIHRvIHVzZSBtb2Rlcm4N CnByb2Nlc3NvciBjYWNoZSBlZmZpY2llbnRseS4gIFRoZXJlIGFyZSBhIG51bWJlciBvZiBwbGFj ZXMgaW4gdGhlIGtlcm5lbA0KdGhhdCBhIG5vbi1vdmVybGFwcGluZyByYW5nZS1iYXNlZCB0cmVl IHdvdWxkIGJlIGJlbmVmaWNpYWwsIGVzcGVjaWFsbHkNCm9uZSB3aXRoIGEgc2ltcGxlIGludGVy ZmFjZS4gIElmIHlvdSB1c2UgYW4gcmJ0cmVlIHdpdGggb3RoZXIgZGF0YQ0Kc3RydWN0dXJlcyB0 byBpbXByb3ZlIHBlcmZvcm1hbmNlIG9yIGFuIGludGVydmFsIHRyZWUgdG8gdHJhY2sNCm5vbi1v dmVybGFwcGluZyByYW5nZXMsIHRoZW4gdGhpcyBpcyBmb3IgeW91Lg0KDQpUaGUgdHJlZSBoYXMg YSBicmFuY2hpbmcgZmFjdG9yIG9mIDEwIGZvciBub24tbGVhZiBub2RlcyBhbmQgMTYgZm9yIGxl YWYNCm5vZGVzLiAgV2l0aCB0aGUgaW5jcmVhc2VkIGJyYW5jaGlu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AgICAgICAgICAgICAgICAgIHwgICAxMiArDQogaW5jbHVkZS9saW51 eC9tYXBsZV90cmVlLmggICAgICAgICAgICAgICAgICAgIHwgIDY4NCArKw0KIGluY2x1ZGUvdHJh Y2UvZXZlbnRzL21hcGxlX3RyZWUuaCAgICAgICAgICAgICB8ICAxMjMgKw0KIGluaXQvbWFpbi5j ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgIDIgKw0KIGxpYi9LY29uZmln LmRlYnVnICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgMTUgKw0KIGxpYi9NYWtlZmls ZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgIDMgKy0NCiBsaWIvbWFwbGVf dHJlZS5jICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCA3MTAyICsrKysrKysrKysrKysr KysrDQogdG9vbHMvdGVzdGluZy9yYWRpeC10cmVlLy5naXRpZ25vcmUgICAgICAgICAgIHwgICAg MiArDQogdG9vbHMvdGVzdGluZy9yYWRpeC10cmVlL2dlbmVyYXRlZC9hdXRvY29uZi5oIHwgICAg MSArDQogdG9vbHMvdGVzdGluZy9yYWRpeC10cmVlL2xpbnV4L21hcGxlX3RyZWUuaCAgIHwgICAg NyArDQogdG9vbHMvdGVzdGluZy9yYWRpeC10cmVlL21hcGxlLmMgICAgICAgICAgICAgIHwgICA1 OSArDQogLi4uL3JhZGl4LXRyZWUvdHJhY2UvZXZlbnRzL21hcGxlX3RyZWUuaCAgICAgIHwgICAg NSArDQogMTQgZmlsZXMgY2hhbmdlZCwgODIzMiBpbnNlcnRpb25zKCspLCAxIGRlbGV0aW9uKC0p DQogY3JlYXRlIG1vZGUgMTAwNjQ0IERvY3VtZW50YXRpb24vY29yZS1hcGkvbWFwbGVfdHJlZS5y c3QNCiBjcmVhdGUgbW9kZSAxMDA2NDQgaW5jbHVkZS9saW51eC9tYXBsZV90cmVlLmgNCiBjcmVh dGUgbW9kZSAxMDA2NDQgaW5jb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VGhlIHRlcm0gcGl2b3QgaXMgdXNlZCB0bw0KKyAqIGluZGljYXRlIHRoYXQgdGhl IHRyZWUgaXMgc3BlY2lmeWluZyByYW5nZXMsICBQaXZvdHMgbWF5IGFwcGVhciBpbiB0aGUNCisg KiBzdWJ0cmVlIHdpdGggYW4gZW50cnkgYXR0YWNoZWQgdG8gdGhlIHZhbHVlIHdoZXJlIGFzIGtl eXMgYXJlIHVuaXF1ZSB0byBhDQorICogc3BlY2lmaWMgcG9zaXRpb24gb2YgYSBCLXRyZWUuICBQ aXZvdCB2YWx1ZXMgYXJlIGluY2x1c2l2ZSBvZiB0aGUgc2xvdCB3aXRoDQorICogdGhlIHNhbWUg aW5kZXguDQorICoNCisgKg0KKyAqIFRoZSBmb2xsb3dpbmcgaWxsdXN0cmF0ZXMgdGhlIGxheW91 dCBvZiBhIHJhbmdlNjQgbm9kZXMgc2xvdHMgYW5kIHBpdm90cy4NCisgKg0KKyAqDQorICogIFNs b3RzIC0+IHwgMCB8IDEgfCAyIHwgLi4uIHwgMTIgfCAxMyB8IDE0IHwgMTUgfA0KKyAqICAgICAg ICAgICDilKwgICDilKwgICDilKwgICDilKwgICAgIOKUrCAgICDilKwgICAg4pSsICAgIOKUrCAg ICDilKwNCisgKiAgICAgICAgICAg4pSCICAg4pSCICAg4pSCICAg4pSCICAgICDilIIgICAg4pSC ICAgIOKUgiAgICDilIIgICAg4pSU4pSAIEltcGxpZWQgbWF4aW11bQ0KKyAqICAgICAgICAgICDi lIIgICDilIIgICDilIIgICDilIIgICAgIOKUgiAgICDilIIgICAg4pSCICAgIOKUlOKUgCBQaXZv dCAxNA0KKyAqICAgICAgICAgICDilIIgICDilIIgICDilIIgICDilIIgICAgIOKUgiAgICDilIIg ICAg4pSU4pSAIFBpdm90IDEzDQorICogICAgICAgICAgIOKUgiAgIOKUgiAgIOKUgiAgIOKUgiAg ICAg4pSCICAgIOKUlOKUgCBQaXZvdCAxMg0KKyAqICAgICAgICAgICDilIIgICDilIIgICD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