unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Kevin Ryde <user42@zip.com.au>
Subject: make-uniform-vector bit vector versus array-set!
Date: Sun, 26 Feb 2006 07:44:59 +1100	[thread overview]
Message-ID: <87zmkfuq0k.fsf@zip.com.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 525 bytes --]

In 1.8 there seems to be something a bit evil in array-set! on a bit
vector created by make-uniform-vector,

	guile> (define a (make-uniform-vector 15 #t #t))
	guile> a
	#*111111111111111
	guile> (array-set! a #f 0)
	guile> a
	(2207 . #<smob 80ba960>)

I don't understand all that stuff, but I got some joy from this
change.  Can someone (Marius?) confirm or deny?

        * unif.c (bitvector_set): Should be h->writable_elements not
        h->elements, the latter results in a segv in array-set! on a bit
        vector.


[-- Attachment #2: unif.c.writable_elements.diff --]
[-- Type: text/plain, Size: 487 bytes --]

--- unif.c.~1.192.2.2.~	2006-02-14 08:59:03.000000000 +1100
+++ unif.c	2006-02-25 18:22:35.000000000 +1100
@@ -380,9 +380,9 @@
   pos += scm_array_handle_bit_elements_offset (h);
   mask = 1l << (pos % 32);
   if (scm_to_bool (val))
-    ((scm_t_uint32 *)h->elements)[pos/32] |= mask;
+    ((scm_t_uint32 *)h->writable_elements)[pos/32] |= mask;
   else
-    ((scm_t_uint32 *)h->elements)[pos/32] &= ~mask;
+    ((scm_t_uint32 *)h->writable_elements)[pos/32] &= ~mask;
 }
 
 static void

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel

             reply	other threads:[~2006-02-25 20:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-25 20:44 Kevin Ryde [this message]
2006-02-26 10:00 ` make-uniform-vector bit vector versus array-set! Marius Vollmer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zmkfuq0k.fsf@zip.com.au \
    --to=user42@zip.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).