src/Pure/General/sha1.ML
changeset 72535 7cb68b5b103d
parent 72534 e0c6522d5d43
child 72537 18eed4f718e0
equal deleted inserted replaced
72534:e0c6522d5d43 72535:7cb68b5b103d
   146 (* C library and memory *)
   146 (* C library and memory *)
   147 
   147 
   148 val library_path =
   148 val library_path =
   149   Path.explode ("$ML_HOME/" ^ (if ML_System.platform_is_windows then "sha1.dll" else "libsha1.so"));
   149   Path.explode ("$ML_HOME/" ^ (if ML_System.platform_is_windows then "sha1.dll" else "libsha1.so"));
   150 
   150 
   151 val library_call =
   151 fun build_call () =
   152   Foreign.buildCall3
   152   Foreign.buildCall3
   153     (Foreign.getSymbol (Foreign.loadLibrary (File.platform_path library_path)) "sha1_buffer",
   153     (Foreign.getSymbol (Foreign.loadLibrary (File.platform_path library_path)) "sha1_buffer",
   154       (Foreign.cByteArray, Foreign.cUlong, Foreign.cPointer), Foreign.cPointer);
   154       (Foreign.cByteArray, Foreign.cUlong, Foreign.cPointer), Foreign.cPointer);
       
   155 
       
   156 val library_call =
       
   157   if ML_System.platform_is_arm then fn args => build_call () args else build_call ();
   155 
   158 
   156 fun with_memory n =
   159 fun with_memory n =
   157   Thread_Attributes.uninterruptible (fn restore_attributes => fn f =>
   160   Thread_Attributes.uninterruptible (fn restore_attributes => fn f =>
   158     let
   161     let
   159       val mem = Foreign.Memory.malloc (Word.fromInt n);
   162       val mem = Foreign.Memory.malloc (Word.fromInt n);