unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* make-uniform-vector bit vector versus array-set!
@ 2006-02-25 20:44 Kevin Ryde
  2006-02-26 10:00 ` Marius Vollmer
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Ryde @ 2006-02-25 20:44 UTC (permalink / 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-02-26 10:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-25 20:44 make-uniform-vector bit vector versus array-set! Kevin Ryde
2006-02-26 10:00 ` Marius Vollmer

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).