#// Copyright 2010 The Code Cavern

#//	bda_store(bda_ptr,bda_len,bda_digit)
#//	          rdi,      rsi,  rdx

.global bda_store
.global bda_store_nz
bda_store:

cmp $0,%rsi
jz case0

bda_store_nz:

movq %rdx,%xmm0
movddup %xmm0,%xmm0
lea -16(%rdi),%rdi
test $0xF,%rdi
jz notodd
	mov %rdx,16(%rdi)
	lea 8(%rdi),%rdi
	sub $1,%rsi
notodd:
sub $2,%rsi
jc skiplp
.align 16
lp:
	lea 16(%rdi),%rdi
	sub $2,%rsi
	movdqa %xmm0,(%rdi)
	jnc lp
skiplp:
jnp case0
	mov %rdx,16(%rdi)
case0:
	ret
