From owner-freebsd-arch@freebsd.org Wed Jul 10 21:29:31 2019 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 860D015E3E42 for ; Wed, 10 Jul 2019 21:29:31 +0000 (UTC) (envelope-from phil@juniper.net) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id A2FA672D62 for ; Wed, 10 Jul 2019 21:29:30 +0000 (UTC) (envelope-from phil@juniper.net) Received: by mailman.ysv.freebsd.org (Postfix) id 6648C15E3E40; Wed, 10 Jul 2019 21:29:30 +0000 (UTC) Delivered-To: arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40FED15E3E3F for ; Wed, 10 Jul 2019 21:29:30 +0000 (UTC) (envelope-from phil@juniper.net) Received: from mx0b-00273201.pphosted.com (mx0b-00273201.pphosted.com [67.231.152.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.pphosted.com", Issuer "Thawte RSA CA 2018" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A78D372D59; Wed, 10 Jul 2019 21:29:26 +0000 (UTC) (envelope-from phil@juniper.net) Received: from pps.filterd (m0108163.ppops.net [127.0.0.1]) by mx0b-00273201.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6ALTOx5024142; Wed, 10 Jul 2019 14:29:24 -0700 Received: from nam04-sn1-obe.outbound.protection.outlook.com (mail-sn1nam04lp2057.outbound.protection.outlook.com [104.47.44.57]) by mx0b-00273201.pphosted.com with ESMTP id 2tnghdgxcg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Jul 2019 14:29:24 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cfsnoSv9mxX37O/Chi/M0VCVEoyy4Q99k2CV2t8zvhD6jdLQAtsXnkEX2nWSbzl9FU0Oz6pQHLEfbM9xElJHAjMJ0TQCfHHxHIUCOZVJuZYNwabXdLM26dzxdhZXH7pT58ToJIbhtP1b3QnEN8nNicJq3W0L3Jfn1B04baUNIa8yD2Z8tHuuNSZ8taUgTSbTOvC5thzYG+25EWJ/K5NgaZA8PTrBSmxZe+ihwkPgZ1RBDelaNEItQVIasM5caQjj8EW3Vo8Atu9VmPQw8nCSHPz0AM53J90Fr3AxaSB4ohnkDxVrG38azwOeFOqQIAGEKZO5ptEmp/u7NBIX5TJdRA== 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-SenderADCheck; bh=o+I/9DrbBZ4kaQHQWvt0g6QDK4FJycsGWHoKX7L7OeI=; b=lVreLNCgiGXvbKPWUBrV0bbQ7ydNAM9vxBeG7mt/g28JeQ26uP28XjgGK146Gl2F2NmyTvTqn8hs6VBPdn4B7jBUfrapuxsV0knUBomxggEUiraU8fMCm9AiCVNRZPBpQfUC7+HB/Hk5g1ti+OHz+H8o3m1Ag0Bq4lSnzJ5z35Cqz03/Wnt6jvYkecHyXGqwtB1BMMqW5F0yTwyDTo7jOvnckdeZKRe6mC1WR/iC/7WTsr3qHQcqKy4OiaV5tqgJFsDRZ0P5HO04arhz0Qnf3oHRD7CBLZBVWWBXsUxHH2rh6ozSe5m43KH5K6K0lIiWq7tCpcjAa0ACIuwbGI9JNw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=softfail (sender ip is 66.129.239.12) smtp.rcpttodomain=freebsd.org smtp.mailfrom=juniper.net;dmarc=fail (p=reject sp=quarantine pct=100) action=oreject header.from=juniper.net;dkim=none (message not signed);arc=none Received: from BYAPR05CA0014.namprd05.prod.outlook.com (2603:10b6:a03:c0::27) by BL0PR05MB5570.namprd05.prod.outlook.com (2603:10b6:208:6c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2073.7; Wed, 10 Jul 2019 21:29:21 +0000 Received: from BY2NAM05FT003.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::207) by BYAPR05CA0014.outlook.office365.com (2603:10b6:a03:c0::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2073.6 via Frontend Transport; Wed, 10 Jul 2019 21:29:21 +0000 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning juniper.net discourages use of 66.129.239.12 as permitted sender) Received: from P-EXFEND-EQX-01.jnpr.net (66.129.239.12) by BY2NAM05FT003.mail.protection.outlook.com (10.152.100.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2052.8 via Frontend Transport; Wed, 10 Jul 2019 21:29:20 +0000 Received: from P-EXBEND-EQX-01.jnpr.net (10.104.8.52) by P-EXFEND-EQX-01.jnpr.net (10.104.8.54) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 10 Jul 2019 14:29:20 -0700 Received: from p-mailhub01.juniper.net (10.104.20.6) by P-EXBEND-EQX-01.jnpr.net (10.104.8.52) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 10 Jul 2019 14:29:20 -0700 Received: from idle.juniper.net (idleski.juniper.net [172.25.5.10]) by p-mailhub01.juniper.net (8.14.4/8.11.3) with ESMTP id x6ALTJYH031875; Wed, 10 Jul 2019 14:29:19 -0700 (envelope-from phil@juniper.net) Received: from [10.0.0.3] (localhost [127.0.0.1]) by idle.juniper.net (8.15.2/8.15.2) with ESMTP id x6ALSDSW009645; Wed, 10 Jul 2019 17:28:13 -0400 (EDT) (envelope-from phil@juniper.net) From: Phil Shafer To: John Baldwin CC: Subject: Re: expand_number(3) Date: Wed, 10 Jul 2019 17:29:18 -0400 X-Mailer: MailMate (1.12.5r5635) Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; format=flowed Content-Transfer-Encoding: quoted-printable X-EXCLAIMER-MD-CONFIG: e3cb0ff2-54e7-4646-8a04-0dae4ac7b136 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:66.129.239.12; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(4636009)(376002)(396003)(346002)(39860400002)(136003)(2980300002)(199004)(189003)(70206006)(70586007)(336012)(229853002)(14444005)(36756003)(6916009)(6306002)(53936002)(2906002)(50226002)(8746002)(26005)(6246003)(8936002)(33656002)(316002)(186003)(426003)(305945005)(8676002)(486006)(81166006)(86362001)(53546011)(966005)(81156014)(68736007)(446003)(67846002)(11346002)(126002)(47776003)(476003)(76506006)(2616005)(4326008)(7126003)(450100002)(5660300002)(356004)(51416003)(76176011)(50466002)(478600001)(69596002); DIR:OUT; SFP:1102; SCL:1; SRVR:BL0PR05MB5570; H:P-EXFEND-EQX-01.jnpr.net; FPR:; SPF:SoftFail; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 67689a77-3d40-4d73-0e35-08d7057dabdc X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(4710121)(4711121)(1401327)(2017052603328); SRVR:BL0PR05MB5570; X-MS-TrafficTypeDiagnostic: BL0PR05MB5570: X-MS-Exchange-PUrlCount: 2 X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-Forefront-PRVS: 0094E3478A X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: nCnlTOdwkte6U7XW263oZSTaxzSCzmntX4Pf/onRbQqKyj8H6lQsK8b36Q9mpHsXUdx3XwxHZwqiuDT+1+ENsLWrO512EXeT9DymXfFrF0u6RwHGngj4IFB8mI8Qx/t3tRuf9IT1h87TYenUxQ1m4L4i9JRaln0Fq2BfeyhvD2TCE2madCGvirkgEc7oajdx9i4l8u0rc20806p08aiP5eKjWKc0kxipIgrP8BsilIHDYmrJ3o6kBNtoKMWSz4yzltNiY1IWFR5C2PcTNUWjHsfRqSxniMcBKM+mgRKj6MhP2ht+x6ag9k7m1TPmkZxKKEgYGhECd6wuzNSP2ZVb+w7DLdG77xK19d8iBd5yjfcgioSaBHCqJHm2jv2eDTGztekG5/xaN9uajeBXM9ksQI/D6jdN/PBm5rqx+fXe7sw= X-OriginatorOrg: juniper.net X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2019 21:29:20.8370 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 67689a77-3d40-4d73-0e35-08d7057dabdc X-MS-Exchange-CrossTenant-Id: bea78b3c-4cdb-4130-854a-1d193232e5f4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bea78b3c-4cdb-4130-854a-1d193232e5f4; Ip=[66.129.239.12]; Helo=[P-EXFEND-EQX-01.jnpr.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR05MB5570 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-10_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_spam_notspam policy=outbound_spam score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907100248 X-Rspamd-Queue-Id: A78D372D59 X-Spamd-Bar: ------ X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.98)[-0.977,0] X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 21:29:31 -0000 Would a reasonable goal be to make expand_number and humanize_number = (with HN_IEC_PREFIXES) should be as compatible as possible? The API doesn't allow many humanize-style features, but having the = number->string->number work would be ideal so support for = HN_DECIMAL-style input should be added, so "1.1K" does the right thing = (thought it rounds to 1126). Lacking support for "suffix", trailing garbage should not be an error = (ala atoi), though I wish there was a parameter like strtol()'s endptr = to pass the next point to the character back in. If there was a suffix = parameter, the endptr would be skipped over it, if present. The expand_number API uses uint64_t where humanize_number uses signed = int64_t so the answer for negative numbers is DOA. Is it worth making a new expandize_number() function = (dehumanize_number?) that brings the API more into sync with = humanize_number? Thanks, Phil On 10 Jul 2019, at 14:14, John Baldwin wrote: > While working on some bhyve changes I happened to look at the source > to expand_number(3) and noticed what I think are several bugs. I > wrote some tests to validate that these bugs are present, but in some > cases I'm not sure what the correct / desired behavior is? I posted > a review with the tests and questions about what some of the behavior > should be with folks who have worked on expand_number(3) previously, > but haven't gotten any feedback. The URL to the review is below if > other folks would like to offer feedback on some of my open questions > such as should we support negative numbers, hex and octal bases, > trailing garbage, etc.? > > https://urldefense.proofpoint.com/v2/url?u=3Dhttps-3A__reviews.freebsd.= org_D20796&d=3DDwICAg&c=3DHAkYuh63rsuhr6Scbfh0UjBXeMK-ndb3voDTXcWzoCI&r=3D= And7spKEXmRNIrq8pYCiSg&m=3DEHG6EmocNCDS6VoOZVxzZoCq-BqbJjBpsC9kXhGFTd0&s=3D= bUQ8xvhg6vv95W5fHxswOrzDIeVxFsFJIa2582tjHgA&e=3D > > -- = > John Baldwin > _______________________________________________ > freebsd-arch@freebsd.org mailing list > https://urldefense.proofpoint.com/v2/url?u=3Dhttps-3A__lists.freebsd.or= g_mailman_listinfo_freebsd-2Darch&d=3DDwICAg&c=3DHAkYuh63rsuhr6Scbfh0UjBX= eMK-ndb3voDTXcWzoCI&r=3DAnd7spKEXmRNIrq8pYCiSg&m=3DEHG6EmocNCDS6VoOZVxzZo= Cq-BqbJjBpsC9kXhGFTd0&s=3D_ChOm4nn2d9pTlDuA6I2EdYXc73LOiS_N4c0k0DOWPo&e=3D= > To unsubscribe, send any mail to = > "freebsd-arch-unsubscribe@freebsd.org"