nv-facutil-slct-ta 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +38 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -205,6 +205,37 @@ const creat_on_ab =(Cls,requested_cnt,ab,offset=0)=>{
205
205
  }
206
206
  }
207
207
 
208
+ const is_rng_overlaped = (si0,ei0,si1,ei1)=>{
209
+ //assume(si0< ei0, si1< ei1)
210
+ if(ei0<=si1) {return false;}
211
+ if(ei1<=si0) {return false;}
212
+ return true;
213
+ }
214
+
215
+ const is_ab_rng_overlaped = (abrng0,abrng1)=>{
216
+ var [ab0,si0,ei0] = abrng0;
217
+ var [ab1,si1,ei1] = abrng1;
218
+ if(ab0 === ab1) {
219
+ return is_rng_overlaped(si0,ei0,si1,ei1);
220
+ } else {
221
+ return false;
222
+ }
223
+ }
224
+
225
+ const ta2abrng = (ta)=>[ta.buffer,ta.byteOffset,ta.byteOffset+ta.byteLength]
226
+
227
+ const is_ta_overlaped = (typed_array0,typed_array1)=>is_ab_rng_overlaped(
228
+ ta2abrng(typed_array0),
229
+ ta2abrng(typed_array1),
230
+ );
231
+
232
+ const to_abrng = (o)=> Array.isArray(o)?o:ta2abrng(o);
233
+ const is_overlaped = (o0,o1) => is_ab_rng_overlaped(to_abrng(o0),to_abrng(o1));
234
+
235
+
236
+
237
+
238
+
208
239
  module.exports = {
209
240
  check_sz_and_algn,
210
241
  calc_algn_si,
@@ -226,5 +257,11 @@ module.exports = {
226
257
  ////
227
258
  creat_debug_view,
228
259
  is_ablike,
229
- creat_on_ab
260
+ creat_on_ab,
261
+ is_rng_overlaped,
262
+ is_ab_rng_overlaped,
263
+ ta2abrng,
264
+ is_ta_overlaped,
265
+ to_abrng,
266
+ is_overlaped,
230
267
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nv-facutil-slct-ta",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"