From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sender4-op-o12.zoho.com (sender4-op-o12.zoho.com [136.143.188.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F32B25C713; Wed, 16 Jul 2025 19:18:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.12 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752693540; cv=pass; b=EkLeQhp+AXMvcVAk/zmfLsXAD3V+wpsxjgHuPzdepU3i58a1xm77hjfcp4O6n44pSXZ1mHIv3POg5lYboSgW74lLpOMs/D9Q6P0PmIzCSLOeqBuXg3rfD2UvgdxEYlbVJZn+tecGXHs9fQI0IMh9B4tF5vDdZ3je+nwVv4A0YX0= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752693540; c=relaxed/simple; bh=4m8zHCOak+f62EPi329BsZxzSPeANIfks1AjdMIncco=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=GV5Uabn7Ifm3BaQJuurnHn3gasWqXKnHhgab6qUczpjjEBswcgnHl/jM6ufEci8lOPD9mBX4zUYJfpEWjp/SpNIzGApT4zjZb3h66J7uH9bKQ8So9EO1GSk5pl4Isz0C6KIU9E2RycKNVX8kb/Fc3LwuK0342cntx9wUPfgKSJ4= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=daniel.almeida@collabora.com header.b=Gl4LSMeT; arc=pass smtp.client-ip=136.143.188.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=daniel.almeida@collabora.com header.b="Gl4LSMeT" ARC-Seal: i=1; a=rsa-sha256; t=1752693525; cv=none; d=zohomail.com; s=zohoarc; b=Pyfn0YbHkkP522Ho62leSs31UlOEq8Ph6mvP1iejpBuF+dbWSkSuNyoyog8oAYLi47BGDuuLqPOvtyYCr7bOJLeQXL5ykx6vd05Fxlgnk6StFZQ2aJJv/xbkuk8jky35U+D/V3Ki6gfSSbUObcr1Jw/dbcHhCxoRglK8NtWszZc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752693525; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=0VjJ4c2mLfoMpLDbbWfsXDtpeHHjb7qTAMeR5KY6QC0=; b=nQlEXYePB6RIlFvhEkPcNzHRl9j7chy0jHj2/kFMy5TJfl0PeqrF6tCHImvnyBaZRW0j2OrjdmS1N0kJ9eYgeBREIOGMEAaM2m0stILlej25N8nN4jdzonsdmQqolpXXtud7Ascx/WFEq64lLd69KUlztleqwn8SAltwN1o7Fkc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=daniel.almeida@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1752693525; s=zohomail; d=collabora.com; i=daniel.almeida@collabora.com; h=Content-Type:Mime-Version:Subject:Subject:From:From:In-Reply-To:Date:Date:Cc:Cc:Content-Transfer-Encoding:Message-Id:Message-Id:References:To:To:Reply-To; bh=0VjJ4c2mLfoMpLDbbWfsXDtpeHHjb7qTAMeR5KY6QC0=; b=Gl4LSMeTabxNEinFSyjx7pd7zlL7HAvWuPUn4UAz/ZjESfSEWQBVvj1Saxt6MwtI 7sF9mR3MK5El4FL30nx0qEj79dGgzqKxE4wijnE1dkpFAax81Pz9prrFP3do1z5JDv1 PYj+fByjO6srVqX1aNQn7SddYXjLYhq8iLUsfll0= Received: by mx.zohomail.com with SMTPS id 1752693523304714.3019836740996; Wed, 16 Jul 2025 12:18:43 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.600.51.1.1\)) Subject: Re: [PATCH v9] rust: kernel: add support for bits/genmask macros From: Daniel Almeida In-Reply-To: <705CD461-60D9-492E-B82F-C88A848A4348@collabora.com> Date: Wed, 16 Jul 2025 16:18:26 -0300 Cc: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, Alexandre Courbot Content-Transfer-Encoding: quoted-printable Message-Id: References: <20250714-topics-tyr-genmask2-v9-1-9e6422cbadb6@collabora.com> <705CD461-60D9-492E-B82F-C88A848A4348@collabora.com> To: Danilo Krummrich X-Mailer: Apple Mail (2.3826.600.51.1.1) X-ZohoMailClient: External >=20 >>=20 >> (3) OOC, why did you choose u32 as argument type? >=20 > No reason. i32 is the default integer type and signed integers don=E2=80= =99t make > sense here, so I chose u32. >=20 > Also, we can trivially promote integers to wider types, but the other = way > around is not true. So my reasoning was that if you had u8, or u16s = you could > trivially get u32s using into(), but if you had u32s and e.g. = genmask_u16 > required u16s, you'd have to resort to try_into() or `as`, which is = annoying. >=20 > In any case, feel free to suggest anything else, I think. >=20 > =E2=80=94 Daniel I guess that, using the logic above, one could ask "why not u64 then?". 64bit variables are less commonly used, so this would be the inverse problem, i.e.: we'd see way too many uses of into(). =E2=80=94 Daniel=