From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: Re: [PATCH 2/2] Add module functions to convert from and to big integers. Date: Tue, 23 Apr 2019 17:12:03 +0200 Message-ID: References: <20190423131742.65814-1-phst@google.com> <20190423131742.65814-2-phst@google.com> <102dc3dc-554c-a55e-ae7c-cc7357ee60f5@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="257517"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Philipp Stephani , Emacs developers To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 23 17:13:12 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hIx6d-0014qS-IR for ged-emacs-devel@m.gmane.org; Tue, 23 Apr 2019 17:13:11 +0200 Original-Received: from localhost ([127.0.0.1]:55219 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIx6c-0002nz-Ik for ged-emacs-devel@m.gmane.org; Tue, 23 Apr 2019 11:13:10 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:56999) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIx5k-0002mL-Qf for emacs-devel@gnu.org; Tue, 23 Apr 2019 11:12:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIx5j-0001MO-TF for emacs-devel@gnu.org; Tue, 23 Apr 2019 11:12:16 -0400 Original-Received: from mail-ot1-x344.google.com ([2607:f8b0:4864:20::344]:37435) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hIx5j-0001M3-LZ for emacs-devel@gnu.org; Tue, 23 Apr 2019 11:12:15 -0400 Original-Received: by mail-ot1-x344.google.com with SMTP id c16so13137774otn.4 for ; Tue, 23 Apr 2019 08:12:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=g8hF4nw/UUNogJL2598HQlgB8OmoN80am7xT/ZnXX5k=; b=C3TYtjO1HRU9Du7f+ZzalOmnXUwxeUmKI1PjnV7bADKOAocRHuluVAq1N5BIkCrAwB IKt1uirWePHl+SO2rNGbRLQbT8200TkVSKC0pjhm6Bcr/9PsmaqUwk9ZZdm5ZWVH0P44 P9FynWTvEI+dblt8GvAXGd72T5nal7h3rg382iuo3lxHklkoStIzXkh6jiWJIGFZDByq Vz1rTGbuPTUPUQqbdkGtGK6wBY0gHQfFV6R/Q4gg+ICW01c+EsViNpIDRI7T4JMSf+Tq RS03QTIRg1Md5i3e6aS6VCwt1R3WBrJGIFK8IHYVKHAMvY1w+4NO/Ojr7ky0459geJsj Ddhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=g8hF4nw/UUNogJL2598HQlgB8OmoN80am7xT/ZnXX5k=; b=F4o9wz9pTEt0QKTsUMAh3tv0gFvBLU30bQivsCfRTL0ILqa+vzKg6aPx5PoimEHB+p HXfM2QocnmH2dHgHQM+PUYPemeIb4T3PSZj2w4QxUiuev1d1nx4HeI0P5CH5s9ujeWmZ QC+kQEypdraz0e3ga9HFt/z05r+9NNN7VyHZQMhWrbEDc1a5+ENDwQvZ8ppcClQ86t8e BpsVg2ntz12JIvZMt0zU5/G3eWf3apMreXhBGCbrMgDK6wZyrlFLv7LSHGVq/68rv3NA 4EH+owSL/iMQBzC2zPzs8vh/Bm4Hv0+3n1eMRZQ8NVwdAGOLmbDPGDiZrk8agEK9NAcw xHAQ== X-Gm-Message-State: APjAAAUa0CWJVQL6irhy3m1uk/l5mZmFnvpcNP07wq03IzFZ5Ft7lMMB +nQupwZLF4A9vl2eBzdvv1gpaEA1mz+NCSGpTv8= X-Google-Smtp-Source: APXvYqzjHUkDqDUuFfA8NUi8Fw5qsB2RQWhx1zDSYWi8c677XC39l/IkJkUohkdk0jNRvEwa+aBmdXnZWVQvSB7aDHg= X-Received: by 2002:a05:6830:1559:: with SMTP id l25mr15623949otp.355.1556032334282; Tue, 23 Apr 2019 08:12:14 -0700 (PDT) In-Reply-To: <102dc3dc-554c-a55e-ae7c-cc7357ee60f5@cs.ucla.edu> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::344 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:235824 Archived-At: Am Di., 23. Apr. 2019 um 16:51 Uhr schrieb Paul Eggert : > > On 4/23/19 6:17 AM, Philipp Stephani wrote: > > +@deftypefn Function bool extract_big_integer (emacs_env *@var{env}, emacs_value @var{arg}, int *@var{sign}, ptrdiff_t *@var{size}, unsigned char *@var{magnitude})y > > This sounds reasonably inconvenient for authors of modules, plus it's a > pain to document. Why not just assume GMP instead? It's pretty unlikely > authors would use anything else for bignums. This should simplify the > code not only on the Emacs side but also on the module side; plus it > should improve performance by avoiding roundtrips through mpz_export and > mpz_import. I considered using GMP. However, it has quite a few downsides: - It would require making emacs-module.h dependent on GMP, even for users that don't use big integers. Right now it only depends on standard C, and I'd like to keep it that way. - It's unclear how well GMP is supported in other languages. mpz_t is a weird and unusual type, and other languages might not support it well in their C interface. - Other languages tend to have their own bigint support, so I don't think the advantages of using GMP directly are that big.