aboutsummaryrefslogtreecommitdiff
path: root/data/diffraction.cl
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2010-02-20 17:41:47 +0100
committerThomas White <taw@bitwiz.org.uk>2010-02-20 17:41:47 +0100
commit9323166cf7efccb6c3f74a9f2fefa4efb934436c (patch)
treef1986f869a3d22af8dc5a33cb734f6df21e8bbe7 /data/diffraction.cl
parentfc78b8c7c8c8b8c240a2861142627cc3877c26e7 (diff)
Nicer branching
Diffstat (limited to 'data/diffraction.cl')
-rw-r--r--data/diffraction.cl11
1 files changed, 6 insertions, 5 deletions
diff --git a/data/diffraction.cl b/data/diffraction.cl
index bac0c5c7..5ca7d571 100644
--- a/data/diffraction.cl
+++ b/data/diffraction.cl
@@ -109,15 +109,16 @@ float2 get_sfac(global float2 *sfacs, float16 cell, float4 q)
k = round(kf);
l = round(lf);
+ /* Return a silly value if indices are out of range */
if ( (abs(h) > INDMAX) || (abs(k) > INDMAX) || (abs(l) > INDMAX) ) {
- return 100.0;
+ return 100000.0;
}
- if ( h < 0 ) h += IDIM;
- if ( k < 0 ) k += IDIM;
- if ( l < 0 ) l += IDIM;
+ h = (h>=0) ? h : h+IDIM;
+ k = (k>=0) ? k : k+IDIM;
+ l = (l>=0) ? l : l+IDIM;
- if ( (h>=IDIM) || (k>=IDIM) || (l>=IDIM) ) return 100.0;
+ if ( (h>=IDIM) || (k>=IDIM) || (l>=IDIM) ) return 100000.0;
idx = h + (IDIM*k) + (IDIM*IDIM*l);